oneuptime/CommonServer/Config.ts

150 lines
4.6 KiB
TypeScript
Raw Normal View History

2022-04-10 21:57:14 +00:00
import Protocol from 'Common/Types/API/Protocol';
2022-04-22 12:05:34 +00:00
import ObjectID from 'Common/Types/ObjectID';
2022-04-27 19:38:55 +00:00
import Port from 'Common/Types/Port';
2022-04-26 20:24:24 +00:00
import Hostname from 'Common/Types/API/Hostname';
2022-11-10 16:56:20 +00:00
import Route from 'Common/Types/API/Route';
2022-11-12 20:24:49 +00:00
import SubscriptionPlan from 'Common/Types/Billing/SubscriptionPlan';
2022-04-08 21:15:45 +00:00
2022-05-25 18:24:43 +00:00
export const DisableSignup: boolean = process.env['DISABLE_SIGNUP'] === 'true';
2022-05-09 20:30:55 +00:00
2022-11-16 11:32:27 +00:00
export const IsBillingEnabled: boolean =
process.env['BILLING_ENABLED'] === 'true';
2022-11-12 18:34:13 +00:00
export const BillingPublicKey: string = process.env['BILLING_PUBLIC_KEY'] || '';
2022-11-16 11:32:27 +00:00
export const BillingPrivateKey: string =
process.env['BILLING_PRIVATE_KEY'] || '';
2022-05-09 20:49:16 +00:00
2022-05-31 13:01:53 +00:00
export const DatabaseHost: Hostname = Hostname.fromString(
2022-11-27 20:16:28 +00:00
process.env['DATABASE_HOST'] || 'postgres'
2022-04-29 19:54:29 +00:00
);
2022-04-08 21:15:45 +00:00
2022-12-07 06:44:17 +00:00
export const DatabasePort: Port = new Port(
process.env['DATABASE_PORT'] || '5432'
);
2022-04-08 21:15:45 +00:00
2022-04-27 19:38:55 +00:00
export const DatabaseUsername: string =
2022-04-29 19:54:29 +00:00
process.env['DATABASE_USERNAME'] || 'oneuptimedbuser';
2022-04-27 19:38:55 +00:00
2022-12-07 06:44:17 +00:00
export const DatabasePassword: string =
process.env['DATABASE_PASSWORD'] || 'password';
2022-04-27 19:38:55 +00:00
2022-04-29 19:54:29 +00:00
export const DatabaseName: string =
process.env['DATABASE_NAME'] || 'oneuptimedb';
2022-04-08 21:15:45 +00:00
2022-05-10 20:40:45 +00:00
export const EncryptionSecret: ObjectID = new ObjectID(
2022-11-27 20:16:28 +00:00
process.env['ENCRYPTION_SECRET'] || 'secret'
2022-05-10 20:40:45 +00:00
);
2022-04-08 21:15:45 +00:00
2022-04-20 20:57:05 +00:00
export const AirtableApiKey: string = process.env['AIRTABLE_API_KEY'] || '';
2022-04-08 21:15:45 +00:00
2022-04-20 20:57:05 +00:00
export const AirtableBaseId: string = process.env['AIRTABLE_BASE_ID'] || '';
2022-04-08 21:15:45 +00:00
2022-04-22 12:05:34 +00:00
export const ClusterKey: ObjectID = new ObjectID(
2022-11-27 20:16:28 +00:00
process.env['ONEUPTIME_SECRET'] || 'secret'
2022-04-22 12:05:34 +00:00
);
2022-04-08 21:15:45 +00:00
2022-11-10 16:56:20 +00:00
export const Domain: Hostname = Hostname.fromString(
2022-11-27 20:16:28 +00:00
process.env['DOMAIN'] || 'localhost'
2022-11-10 16:56:20 +00:00
);
2022-05-31 13:01:53 +00:00
export const RealtimeHostname: Hostname = Hostname.fromString(
2022-11-27 20:16:28 +00:00
process.env['REALTIME_HOSTNAME'] || 'realtime'
2022-04-29 19:54:29 +00:00
);
2022-04-08 21:15:45 +00:00
2022-05-31 13:01:53 +00:00
export const MailHostname: Hostname = Hostname.fromString(
2022-11-27 20:16:28 +00:00
process.env['MAIL_HOSTNAME'] || 'mail'
2022-05-10 19:26:44 +00:00
);
2022-11-28 18:26:07 +00:00
export const WorkerHostname: Hostname = Hostname.fromString(
process.env['WORKER_HOSTNAME'] || 'mail'
);
2022-05-31 13:01:53 +00:00
export const DashboardApiHostname: Hostname = Hostname.fromString(
2022-11-27 20:16:28 +00:00
process.env['DASHBOARD_API_HOSTNAME'] || 'dashboard-api'
2022-04-29 19:54:29 +00:00
);
2022-04-26 13:23:33 +00:00
2022-05-31 13:01:53 +00:00
export const ProbeApiHostname: Hostname = Hostname.fromString(
2022-11-27 20:16:28 +00:00
process.env['PROBE_API_HOSTNAME'] || 'probe-api'
2022-04-29 19:54:29 +00:00
);
2022-04-26 13:23:33 +00:00
2022-05-31 13:01:53 +00:00
export const DataIngestorHostname: Hostname = Hostname.fromString(
2022-11-27 20:16:28 +00:00
process.env['DATA_INGESTOR_HOSTNAME'] || 'daat-ingestor'
2022-04-29 19:54:29 +00:00
);
2022-04-18 14:38:26 +00:00
2022-05-31 13:01:53 +00:00
export const AccountsHostname: Hostname = Hostname.fromString(
2022-11-27 20:16:28 +00:00
process.env['ACCOUNTS_HOSTNAME'] || 'accounts'
2022-05-10 19:26:44 +00:00
);
2022-05-31 13:01:53 +00:00
export const HomeHostname: Hostname = Hostname.fromString(
2022-11-27 20:16:28 +00:00
process.env['HOME_HOSTNAME'] || 'home'
2022-05-10 19:26:44 +00:00
);
2022-05-31 13:01:53 +00:00
export const DashboardHostname: Hostname = Hostname.fromString(
2022-11-27 20:16:28 +00:00
process.env['DASHBOARD_HOSTNAME'] || 'dashboard'
2022-05-10 19:26:44 +00:00
);
2022-11-27 20:16:28 +00:00
export const Env: string = process.env['NODE_ENV'] || 'production';
2022-04-08 21:15:45 +00:00
2022-11-27 20:16:28 +00:00
export const Version: string = process.env['npm_package_version'] || '1.0.0';
2022-04-18 14:38:26 +00:00
2022-04-15 15:34:18 +00:00
export const HttpProtocol: Protocol = (
2022-11-27 20:16:28 +00:00
process.env['HTTP_PROTOCOL'] || 'https'
2022-04-08 21:15:45 +00:00
).includes('https')
? Protocol.HTTPS
2022-04-17 14:01:39 +00:00
: Protocol.HTTP;
2022-07-14 13:34:48 +00:00
2022-07-14 21:38:27 +00:00
// Redis does not require password.
2022-11-27 20:16:28 +00:00
export const RedisHostname: string = process.env['REDIS_HOST'] || 'redis';
2022-12-07 06:44:17 +00:00
export const RedisPassword: string =
process.env['REDIS_PASSWORD'] || 'password';
2022-11-27 20:16:28 +00:00
export const RedisPort: Port = new Port(process.env['REDIS_PORT'] || '6379');
2022-11-10 16:56:20 +00:00
2022-11-10 19:43:43 +00:00
export const DashboardApiRoute: Route = new Route(
2022-11-27 20:16:28 +00:00
process.env['DASHBOARD_API_ROUTE'] || '/dashboard-api'
2022-11-10 19:43:43 +00:00
);
2022-11-10 16:56:20 +00:00
2022-11-10 19:43:43 +00:00
export const IdentityRoute: Route = new Route(
2022-11-27 20:16:28 +00:00
process.env['IDENTITY_ROUTE'] || '/identity'
2022-11-10 19:43:43 +00:00
);
2022-11-10 16:56:20 +00:00
2022-11-27 20:16:28 +00:00
export const FileRoute: Route = new Route(process.env['FILE_ROUTE'] || '/file');
2022-11-10 16:56:20 +00:00
2022-11-10 19:43:43 +00:00
export const StausPageRoute: Route = new Route(
2022-11-27 20:16:28 +00:00
process.env['STATUS_PAGE_ROUTE'] || '/status-page'
2022-11-10 19:43:43 +00:00
);
2022-11-10 16:56:20 +00:00
2022-11-10 19:43:43 +00:00
export const DashboardRoute: Route = new Route(
2022-11-27 20:16:28 +00:00
process.env['DASHBOARD_ROUTE'] || '/dashboard'
2022-11-10 19:43:43 +00:00
);
2022-11-10 16:56:20 +00:00
2022-11-10 19:43:43 +00:00
export const IntegrationRoute: Route = new Route(
2022-11-27 20:16:28 +00:00
process.env['INTEGRATION_ROUTE'] || '/integration'
2022-11-10 19:43:43 +00:00
);
2022-11-10 16:56:20 +00:00
2022-12-07 06:44:17 +00:00
export const HelmRoute: Route = new Route(
process.env['HELMCHART_ROUTE'] || '/helm-chart'
);
2022-11-10 19:43:43 +00:00
export const AccountsRoute: Route = new Route(
2022-11-27 20:16:28 +00:00
process.env['ACCOUNTS_ROUTE'] || '/accounts'
2022-11-10 19:43:43 +00:00
);
2022-11-10 16:56:20 +00:00
2022-11-10 19:43:43 +00:00
export const ApiDocsRoute: Route = new Route(
2022-11-27 20:16:28 +00:00
process.env['APIDOCS_ROUTE'] || '/api-docs'
2022-11-10 19:43:43 +00:00
);
2022-11-10 16:56:20 +00:00
export const AdminDashboardRoute: Route = new Route(
2022-11-27 20:16:28 +00:00
process.env['ADMINDASHBOARD_ROUTE'] || '/admin-dashboard'
2022-11-10 16:56:20 +00:00
);
2022-11-12 20:24:49 +00:00
2022-11-16 11:32:27 +00:00
export const IsProduction: boolean =
process.env['ENVIRONMENT'] === 'production';
2022-11-12 20:24:49 +00:00
2022-11-22 13:26:22 +00:00
export const IsDevelopment: boolean =
process.env['ENVIRONMENT'] === 'development';
2022-11-24 15:13:21 +00:00
export const IsTest: boolean = process.env['ENVIRONMENT'] === 'test';
2022-11-22 13:26:22 +00:00
2022-11-16 11:32:27 +00:00
export const SubscriptionPlans: Array<SubscriptionPlan> =
SubscriptionPlan.getSubscriptionPlans();
2022-12-13 12:12:08 +00:00
export const AnalyticsKey: string = process.env['ANALYTICS_KEY'] || '';
export const AnalyticsHost: string = process.env['ANALYTICS_HOST'] || '';