mirror of
https://github.com/ToolJet/ToolJet
synced 2026-04-21 13:37:28 +00:00
* SSO for GitHub Enterprise self hosted * changes * test cases * fixes * label fix * fixes * readme changes
39 lines
1 KiB
TypeScript
39 lines
1 KiB
TypeScript
import { Injectable } from '@nestjs/common';
|
|
|
|
@Injectable()
|
|
export class AppConfigService {
|
|
async public_config() {
|
|
const whitelistedConfigVars = process.env.ALLOWED_CLIENT_CONFIG_VARS
|
|
? this.fetchAllowedConfigFromEnv()
|
|
: this.fetchDefaultConfig();
|
|
|
|
const mapEntries = await Promise.all(
|
|
whitelistedConfigVars.map((envVar) => [envVar, process.env[envVar]] as [string, string])
|
|
);
|
|
|
|
return Object.fromEntries(mapEntries);
|
|
}
|
|
|
|
fetchDefaultConfig() {
|
|
return [
|
|
'TOOLJET_SERVER_URL',
|
|
'RELEASE_VERSION',
|
|
'GOOGLE_MAPS_API_KEY',
|
|
'APM_VENDOR',
|
|
'SENTRY_DNS',
|
|
'SENTRY_DEBUG',
|
|
'DISABLE_SIGNUPS',
|
|
'DISABLE_MULTI_WORKSPACE',
|
|
'SSO_GOOGLE_OAUTH2_CLIENT_ID',
|
|
'SSO_GIT_OAUTH2_CLIENT_ID',
|
|
'SSO_GIT_OAUTH2_HOST',
|
|
'SSO_DISABLE_SIGNUPS',
|
|
];
|
|
}
|
|
|
|
fetchAllowedConfigFromEnv() {
|
|
const whitelistedConfigVars = process.env.ALLOWED_CLIENT_CONFIG_VARS.split(',').map((envVar) => envVar.trim());
|
|
|
|
return whitelistedConfigVars;
|
|
}
|
|
}
|