diff --git a/AdminDashboard/src/App.tsx b/AdminDashboard/src/App.tsx index eac4da2ab0..1ec914c427 100644 --- a/AdminDashboard/src/App.tsx +++ b/AdminDashboard/src/App.tsx @@ -19,7 +19,6 @@ import Users from './Pages/Users/Index'; import Logout from './Pages/Logout/Logout'; // Settings Pages. -import SettingsHost from './Pages/Settings/Host/Index'; import SettingsEmail from './Pages/Settings/SMTP/Index'; import SettingsCallSMS from './Pages/Settings/CallSMS/Index'; import SettingsProbes from './Pages/Settings/Probes/Index'; diff --git a/AdminDashboard/src/Pages/Settings/Host/Index.tsx b/AdminDashboard/src/Pages/Settings/Host/Index.tsx deleted file mode 100644 index 8add103674..0000000000 --- a/AdminDashboard/src/Pages/Settings/Host/Index.tsx +++ /dev/null @@ -1,83 +0,0 @@ -import Route from 'Common/Types/API/Route'; -import FormFieldSchemaType from 'CommonUI/src/Components/Forms/Types/FormFieldSchemaType'; -import CardModelDetail from 'CommonUI/src/Components/ModelDetail/CardModelDetail'; -import Page from 'CommonUI/src/Components/Page/Page'; -import React, { FunctionComponent, ReactElement } from 'react'; -import PageMap from '../../../Utils/PageMap'; -import RouteMap, { RouteUtil } from '../../../Utils/RouteMap'; -import DashboardSideMenu from '../SideMenu'; -import GlobalConfig from 'Model/Models/GlobalConfig'; -import ObjectID from 'Common/Types/ObjectID'; -import FieldType from 'CommonUI/src/Components/Types/FieldType'; - -const Settings: FunctionComponent = (): ReactElement => { - return ( - } - > - {/* Project Settings View */} - - - ); -}; - -export default Settings; diff --git a/CommonServer/API/GlobalConfigAPI.ts b/CommonServer/API/GlobalConfigAPI.ts index 99f7748419..2eaca99120 100644 --- a/CommonServer/API/GlobalConfigAPI.ts +++ b/CommonServer/API/GlobalConfigAPI.ts @@ -9,7 +9,7 @@ import { } from '../Utils/Express'; import Response from '../Utils/Response'; import BaseAPI from './BaseAPI'; -import ObjectID from 'Common/Types/ObjectID'; +// import ObjectID from 'Common/Types/ObjectID'; export default class GlobalConfigAPI extends BaseAPI< GlobalConfig, @@ -26,20 +26,20 @@ export default class GlobalConfigAPI extends BaseAPI< next: NextFunction ) => { try { - const globalConfig: GlobalConfig | null = - await GlobalConfigService.findOneById({ - id: ObjectID.getZeroObjectID(), - select: { - useHttps: true, - }, - props: { - isRoot: true, - }, - }); + // const globalConfig: GlobalConfig | null = + // await GlobalConfigService.findOneById({ + // id: ObjectID.getZeroObjectID(), + // select: { + // useHttps: true, + // }, + // props: { + // isRoot: true, + // }, + // }); return Response.sendJsonObjectResponse(req, res, { - USE_HTTPS: - globalConfig?.useHttps?.toString() || 'false', + // USE_HTTPS: + // globalConfig?.useHttps?.toString() || 'false', }); } catch (err) { next(err); diff --git a/CommonServer/DatabaseConfig.ts b/CommonServer/DatabaseConfig.ts index 9465a626b1..d5687cd6dc 100644 --- a/CommonServer/DatabaseConfig.ts +++ b/CommonServer/DatabaseConfig.ts @@ -37,9 +37,9 @@ export default class DatabaseConfig { } public static async getHttpProtocol(): Promise { - return (await DatabaseConfig.getFromGlobalConfig('useHttps')) + return Promise.resolve((process.env['HTTP_PROTOCOL'] === 'https') ? Protocol.HTTPS - : Protocol.HTTP; + : Protocol.HTTP); } public static async getAccountsUrl(): Promise { diff --git a/CommonUI/src/Config.ts b/CommonUI/src/Config.ts index ce8953e243..70e8be5072 100644 --- a/CommonUI/src/Config.ts +++ b/CommonUI/src/Config.ts @@ -31,7 +31,7 @@ export const env: Function = (key: string): string => { }; export const HTTP_PROTOCOL: Protocol = - env('USE_HTTPS') === 'true' ? Protocol.HTTPS : Protocol.HTTP; + env('HTTP_PROTOCOL') === 'https' ? Protocol.HTTPS : Protocol.HTTP; export const HOST: string = env('HOST') || ''; diff --git a/Model/Models/GlobalConfig.ts b/Model/Models/GlobalConfig.ts index b24e6f6590..32fe34d9d3 100644 --- a/Model/Models/GlobalConfig.ts +++ b/Model/Models/GlobalConfig.ts @@ -40,23 +40,6 @@ export enum EmailServerType { update: [], }) export default class GlobalConfig extends GlobalConfigModel { - @ColumnAccessControl({ - create: [], - read: [], - update: [], - }) - @TableColumn({ - type: TableColumnType.Boolean, - title: 'Use HTTPS', - description: 'Is this server hosted on with SSL/TLS?', - }) - @Column({ - type: ColumnType.Boolean, - nullable: true, - unique: true, - default: false, - }) - public useHttps?: boolean = undefined; @ColumnAccessControl({ create: [], diff --git a/Workers/DataMigrations/AddDefaultGlobalConfig.ts b/Workers/DataMigrations/AddDefaultGlobalConfig.ts index d086551df0..343f2ed611 100644 --- a/Workers/DataMigrations/AddDefaultGlobalConfig.ts +++ b/Workers/DataMigrations/AddDefaultGlobalConfig.ts @@ -13,7 +13,6 @@ export default class AddDefaultGlobalConfig extends DataMigrationBase { const globalConfig: GlobalConfig = new GlobalConfig(); globalConfig.id = ObjectID.getZeroObjectID(); - globalConfig.useHttps = false; globalConfig.emailServerType = EmailServerType.Internal; globalConfig.sendgridFromName = 'OneUptime'; globalConfig.smtpFromName = 'OneUptime'; diff --git a/Workers/DataMigrations/UpdateGlobalCongfigFromEnv.ts b/Workers/DataMigrations/UpdateGlobalCongfigFromEnv.ts index 36c9dae64b..3b699450d9 100644 --- a/Workers/DataMigrations/UpdateGlobalCongfigFromEnv.ts +++ b/Workers/DataMigrations/UpdateGlobalCongfigFromEnv.ts @@ -32,9 +32,6 @@ export default class UpdateGlobalConfigFromEnv extends DataMigrationBase { twilioAuthToken: process.env['TWILIO_AUTH_TOKEN'] || '', twilioPhoneNumber: process.env['TWILIO_PHONE_NUMBER'] || '', - // Update host - useHttps: process.env['HTTP_PROTOCOL'] === 'https', - // Update SMTP smtpUsername: process.env['SMTP_USERNAME'] || '', smtpPassword: process.env['SMTP_PASSWORD'] || '', diff --git a/config.example.env b/config.example.env index 83e386bc9a..8baa1e35e2 100644 --- a/config.example.env +++ b/config.example.env @@ -3,6 +3,9 @@ # Please change this to domain of the server where oneuptime is hosted on. HOST=localhost +# If this server is hosted on SSL / TLS then change this to https +HTTP_PROTOCOL=http + # Secrets - PLEASE CHANGE THESE. Please change these to something random. All of these can be different values. ONEUPTIME_SECRET=please-change-this-to-random-value DATABASE_PASSWORD=please-change-this-to-random-value diff --git a/docker-compose.base.yml b/docker-compose.base.yml index 4de9c04574..16616fda1e 100644 --- a/docker-compose.base.yml +++ b/docker-compose.base.yml @@ -2,6 +2,9 @@ version: '3.7' x-common-variables: &common-variables HOST: ${HOST} + + HTTP_PROTOCOL: ${HTTP_PROTOCOL} + NODE_ENV: ${ENVIRONMENT} BILLING_ENABLED: ${BILLING_ENABLED} BILLING_PUBLIC_KEY: ${BILLING_PUBLIC_KEY}