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({
|
2023-12-14 15:12:13 +01:00
|
|
|
db: process.env.DATABASE_URL
|
|
|
|
? undefined
|
|
|
|
: {
|
|
|
|
user: 'unleash_user',
|
|
|
|
password: 'password',
|
|
|
|
host: 'localhost',
|
|
|
|
port: 5432,
|
|
|
|
database:
|
|
|
|
process.env.UNLEASH_DATABASE_NAME || 'unleash',
|
|
|
|
schema: process.env.UNLEASH_DATABASE_SCHEMA,
|
|
|
|
ssl: false,
|
|
|
|
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,
|
2023-12-08 19:51:12 +01:00
|
|
|
secureHeaders: false,
|
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
|
|
|
anonymiseEventLog: false,
|
2023-02-22 10:10:06 +01:00
|
|
|
responseTimeWithAppNameKillSwitch: false,
|
2023-12-08 12:14:37 +01:00
|
|
|
stripClientHeadersOn304: true,
|
2023-12-11 12:23:18 +01:00
|
|
|
newStrategyConfiguration: true,
|
2023-12-12 10:20:28 +01:00
|
|
|
stripHeadersOnAPI: true,
|
2023-12-21 08:42:28 +01:00
|
|
|
celebrateUnleash: true,
|
|
|
|
increaseUnleashWidth: true,
|
2024-01-03 15:43:22 +01:00
|
|
|
newStrategyConfigurationFeedback: true,
|
2024-02-02 14:39:29 +01:00
|
|
|
featureSearchFeedbackPosting: true,
|
2024-01-12 10:20:03 +01:00
|
|
|
extendedUsageMetricsUI: true,
|
2024-01-18 12:32:25 +01:00
|
|
|
executiveDashboard: true,
|
2024-02-13 13:13:21 +01:00
|
|
|
sdkReporting: 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,
|
2023-05-04 09:56:00 +02:00
|
|
|
tokenName: 'some-user',
|
2022-01-05 10:00:59 +01:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2023-03-17 14:10:21 +01:00
|
|
|
/* can be tweaked to control configuration caching for /api/client/features
|
|
|
|
clientFeatureCaching: {
|
|
|
|
enabled: true,
|
|
|
|
maxAge: 4000,
|
|
|
|
},
|
|
|
|
*/
|
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);
|