2021-08-13 19:22:15 +02:00
|
|
|
import { start } from './lib/server-impl';
|
2021-04-22 15:04:08 +02:00
|
|
|
import { createConfig } from './lib/create-config';
|
2021-04-23 15:31:12 +02:00
|
|
|
import { LogLevel } from './lib/logger';
|
2022-01-05 10:00:59 +01:00
|
|
|
import { ApiTokenType } from './lib/types/models/api-token';
|
2020-04-13 22:38:46 +02:00
|
|
|
|
2021-06-17 20:33:34 +02:00
|
|
|
process.nextTick(async () => {
|
|
|
|
try {
|
2021-08-13 19:22:15 +02:00
|
|
|
await start(
|
2021-06-17 20:33:34 +02:00
|
|
|
createConfig({
|
|
|
|
db: {
|
|
|
|
user: 'unleash_user',
|
|
|
|
password: 'passord',
|
|
|
|
host: 'localhost',
|
|
|
|
port: 5432,
|
2022-03-29 14:59:14 +02:00
|
|
|
database: process.env.UNLEASH_DATABASE_NAME || 'unleash',
|
|
|
|
schema: process.env.UNLEASH_DATABASE_SCHEMA,
|
2021-06-17 20:33:34 +02:00
|
|
|
ssl: false,
|
2022-04-07 20:55:56 +02:00
|
|
|
applicationName: 'unleash',
|
2021-06-17 20:33:34 +02:00
|
|
|
},
|
|
|
|
server: {
|
|
|
|
enableRequestLogger: true,
|
|
|
|
baseUriPath: '',
|
|
|
|
// keepAliveTimeout: 1,
|
|
|
|
gracefulShutdownEnable: true,
|
2022-01-06 10:31:00 +01:00
|
|
|
// cdnPrefix: 'https://cdn.getunleash.io/unleash/v4.4.1',
|
2022-12-08 11:25:39 +01:00
|
|
|
enableHeapSnapshotEnpoint: true,
|
2021-06-17 20:33:34 +02:00
|
|
|
},
|
|
|
|
logLevel: LogLevel.debug,
|
|
|
|
enableOAS: true,
|
2022-01-12 23:22:04 +01:00
|
|
|
// secureHeaders: true,
|
2021-06-17 20:33:34 +02:00
|
|
|
versionCheck: {
|
|
|
|
enable: false,
|
|
|
|
},
|
2021-10-08 10:09:22 +02:00
|
|
|
experimental: {
|
2022-08-26 08:22:42 +02:00
|
|
|
// externalResolver: unleash,
|
|
|
|
flags: {
|
|
|
|
embedProxy: true,
|
2022-08-26 15:16:29 +02:00
|
|
|
embedProxyFrontend: true,
|
2022-08-26 08:22:42 +02:00
|
|
|
batchMetrics: true,
|
|
|
|
anonymiseEventLog: false,
|
2022-09-30 15:28:50 +02:00
|
|
|
responseTimeWithAppName: true,
|
2022-11-18 12:43:24 +01:00
|
|
|
variantsPerEnvironment: true,
|
2023-01-02 11:49:57 +01:00
|
|
|
maintenance: false,
|
2023-01-11 08:23:47 +01:00
|
|
|
featuresExportImport: true,
|
2022-08-26 08:22:42 +02:00
|
|
|
},
|
2021-10-08 10:09:22 +02:00
|
|
|
},
|
2022-01-05 10:00:59 +01:00
|
|
|
authentication: {
|
|
|
|
initApiTokens: [
|
|
|
|
{
|
|
|
|
environment: '*',
|
|
|
|
project: '*',
|
2022-01-05 10:40:22 +01:00
|
|
|
secret: '*:*.964a287e1b728cb5f4f3e0120df92cb5',
|
2022-01-05 10:00:59 +01:00
|
|
|
type: ApiTokenType.ADMIN,
|
|
|
|
username: 'some-user',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2021-06-17 20:33:34 +02:00
|
|
|
}),
|
|
|
|
);
|
|
|
|
} catch (error) {
|
|
|
|
if (error.code === 'EADDRINUSE') {
|
|
|
|
// eslint-disable-next-line no-console
|
|
|
|
console.warn('Port in use. You might want to reload once more.');
|
|
|
|
} else {
|
|
|
|
// eslint-disable-next-line no-console
|
|
|
|
console.error(error);
|
|
|
|
process.exit();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}, 0);
|