Skip to content

Commit 408d70d

Browse files
authored
Merge pull request caprover#1377 from funkhauscreative/master
Adding support for overwriting app defaults NGINX config
2 parents b20e284 + 2b41dc7 commit 408d70d

File tree

1 file changed

+31
-22
lines changed

1 file changed

+31
-22
lines changed

src/datastore/DataStore.ts

Lines changed: 31 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,17 @@ const DEFAULT_NGINX_BASE_CONFIG = fs
2929
const DEFAULT_NGINX_CAPTAIN_CONFIG = fs
3030
.readFileSync(__dirname + '/../../template/root-nginx-conf.ejs')
3131
.toString()
32+
33+
let DEFAULT_NGINX_CONFIG_FOR_APP_PATH =
34+
__dirname + '/../../template/server-block-conf.ejs'
35+
36+
if (fs.pathExistsSync('/captain/data/server-block-conf-override.ejs')) {
37+
DEFAULT_NGINX_CONFIG_FOR_APP_PATH =
38+
'/captain/data/server-block-conf-override.ejs'
39+
}
40+
3241
const DEFAULT_NGINX_CONFIG_FOR_APP = fs
33-
.readFileSync(__dirname + '/../../template/server-block-conf.ejs')
42+
.readFileSync(DEFAULT_NGINX_CONFIG_FOR_APP_PATH)
3443
.toString()
3544

3645
class DataStore {
@@ -81,27 +90,27 @@ class DataStore {
8190
}
8291

8392
/*
84-
"smtp": {
85-
"to": "",
86-
"hostname": "",
87-
"server": "",
88-
"port": "",
89-
"allowNonTls": false,
90-
"password": "",
91-
"username": ""
92-
},
93-
"slack": {
94-
"hook": "",
95-
"channel": ""
96-
},
97-
"telegram": {
98-
"botToken": "",
99-
"chatId": ""
100-
},
101-
"pushBullet": {
102-
"fallbackEmail": "",
103-
"apiToken": ""
104-
}
93+
"smtp": {
94+
"to": "",
95+
"hostname": "",
96+
"server": "",
97+
"port": "",
98+
"allowNonTls": false,
99+
"password": "",
100+
"username": ""
101+
},
102+
"slack": {
103+
"hook": "",
104+
"channel": ""
105+
},
106+
"telegram": {
107+
"botToken": "",
108+
"chatId": ""
109+
},
110+
"pushBullet": {
111+
"fallbackEmail": "",
112+
"apiToken": ""
113+
}
105114
*/
106115
getNetDataInfo() {
107116
const self = this

0 commit comments

Comments
 (0)