1
0
mirror of https://github.com/bitwarden/web synced 2026-02-16 00:24:37 +00:00

Update configurations for self-hosted

This commit is contained in:
Matt Gibson
2022-03-18 17:42:45 -04:00
parent e08726463e
commit a1ec06c834
5 changed files with 26 additions and 7 deletions

View File

@@ -7,6 +7,7 @@
"buttonAction": "https://www.sandbox.paypal.com/cgi-bin/webscr"
},
"dev": {
"port": 8080,
"allowedHosts": "auto"
}
}

View File

@@ -3,9 +3,18 @@
"notifications": "http://localhost:61840"
},
"dev": {
"proxyApi": "http://localhost:4000",
"proxyIdentity": "http://localhost:33656",
"proxyEvents": "http://localhost:46273",
"proxyNotifications": "http://localhost:61840"
"cloud": {
"proxyApi": "http://localhost:4000",
"proxyIdentity": "http://localhost:33656",
"proxyEvents": "http://localhost:46273",
"proxyNotifications": "http://localhost:61840"
},
"selfHosted": {
"proxyApi": "http://localhost:4001",
"proxyIdentity": "http://localhost:33657",
"proxyEvents": "http://localhost:46274",
"proxyNotifications": "http://localhost:61841",
"port": 8081
}
}
}

View File

@@ -19,8 +19,10 @@
"build:bit:dev:watch": "cross-env ENV=development npm run build:bit:watch",
"build:bit:qa": "cross-env NODE_ENV=production ENV=qa npm run build:bit",
"build:bit:cloud": "cross-env NODE_ENV=production ENV=cloud npm run build:bit",
"build:oss:selfhost:watch": "cross-env ENV=selfhosted npm run build:oss:watch",
"build:bit:selfhost:watch": "cross-env ENV=selfhosted npm run build:bit:watch",
"build:oss:selfhost:watch": "cross-env ENV=development SELF_HOSTED=true npm run build:oss:watch",
"build:bit:selfhost:watch": "cross-env ENV=development SELF_HOSTED=true npm run build:bit:watch",
"build:oss:selfhost:dev": "cross-env ENV=development SELF_HOSTED=true npm run build:oss",
"build:bit:selfhost:dev": "cross-env ENV=development SELF_HOSTED=true npm run build:bit",
"build:oss:selfhost:prod": "cross-env ENV=selfhosted NODE_ENV=production npm run build:oss",
"build:bit:selfhost:prod": "cross-env ENV=selfhosted NODE_ENV=production npm run build:bit",
"clean:l10n": "git push origin --delete l10n_master",

View File

@@ -249,7 +249,10 @@ export class WebPlatformUtilsService implements PlatformUtilsService {
}
isSelfHost(): boolean {
return process.env.ENV.toString() === "selfhosted";
return (
process.env.ENV.toString() === "selfhosted" ||
(this.isDev() && process.env.SELF_HOSTED.toString() === "true")
);
}
copyToClipboard(text: string, options?: any): void | boolean {

View File

@@ -15,8 +15,10 @@ const pjson = require("./package.json");
const ENV = process.env.ENV == null ? "development" : process.env.ENV;
const NODE_ENV = process.env.NODE_ENV == null ? "development" : process.env.NODE_ENV;
const SELF_HOSTED = ENV === "selfhosted" || process.env.SELF_HOSTED === "true";
const envConfig = config.load(ENV);
envConfig.dev = SELF_HOSTED ? envConfig.dev.selfHosted : envConfig.dev.cloud;
config.log(envConfig);
const moduleRules = [
@@ -142,6 +144,7 @@ const plugins = [
new webpack.EnvironmentPlugin({
ENV: ENV,
NODE_ENV: NODE_ENV === "production" ? "production" : "development",
SELF_HOSTED: SELF_HOSTED,
APPLICATION_VERSION: pjson.version,
CACHE_TAG: Math.random().toString(36).substring(7),
URLS: envConfig["urls"] ?? {},
@@ -212,6 +215,7 @@ const devServer =
},
hot: false,
allowedHosts: envConfig.dev?.allowedHosts ?? "auto",
port: envConfig.dev?.port ?? 8080,
client: {
overlay: {
errors: true,