41 lines
1.7 KiB
TypeScript
41 lines
1.7 KiB
TypeScript
import * as plugins from './plugins.js';
|
|
import * as paths from './paths.js';
|
|
import { Reception } from './reception/classes.reception.js';
|
|
|
|
export const runCli = async () => {
|
|
const serviceQenv = new plugins.qenv.Qenv('./', './.nogit', false);
|
|
const websiteServer = new plugins.typedserver.utilityservers.UtilityWebsiteServer({
|
|
feedMetadata: null,
|
|
domain: 'idp.global',
|
|
serveDir: paths.distWebDir,
|
|
securityHeaders: {
|
|
csp: {
|
|
defaultSrc: "'self'",
|
|
scriptSrc: ["'self'", "'unsafe-inline'", "'unsafe-eval'", "https://cdn.paddle.com", "https://public.profitwell.com"],
|
|
styleSrc: ["'self'", "'unsafe-inline'", "https://cdn.paddle.com", "https://assetbroker.lossless.one"],
|
|
imgSrc: ["'self'", "data:", "https:"],
|
|
fontSrc: ["'self'", "data:"],
|
|
connectSrc: ["'self'", "https://*.paddle.com", "https://buy.paddle.com", "https://checkout.paddle.com", "https://checkout-service.paddle.com", "https://cdn.paddle.com", "https://*.sentry.io", "https://public.profitwell.com", "wss:"],
|
|
frameSrc: ["https://buy.paddle.com", "https://checkout.paddle.com", "https://*.paddle.com"],
|
|
},
|
|
},
|
|
addCustomRoutes: async (typedserver) => {
|
|
// Enable SPA fallback - serves index.html for non-file routes (e.g., /login, /dashboard)
|
|
typedserver.options.spaFallback = true;
|
|
},
|
|
});
|
|
|
|
// lets add the reception routes
|
|
const reception = new Reception({
|
|
name: (await serviceQenv.getEnvVarOnDemand('INSTANCE_NAME')) || 'idp.global',
|
|
mongoDescriptor: {
|
|
mongoDbUrl: await serviceQenv.getEnvVarOnDemand('MONGODB_URL'),
|
|
},
|
|
websiteServer: websiteServer,
|
|
baseUrl: await serviceQenv.getEnvVarOnDemand('IDP_BASEURL'),
|
|
});
|
|
await reception.start();
|
|
|
|
await websiteServer.start(2999);
|
|
};
|