Skip to content

Commit af49ea1

Browse files
authored
Merge pull request finos#742 from 06kellyjac/load_user_config_for_all_options
2 parents 890997b + fea02a8 commit af49ea1

File tree

1 file changed

+27
-9
lines changed

1 file changed

+27
-9
lines changed

src/config/index.js

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ let _cookieSecret = defaultSettings.cookieSecret;
1717
let _sessionMaxAgeHours = defaultSettings.sessionMaxAgeHours;
1818
let _sslKeyPath = defaultSettings.sslKeyPemPath;
1919
let _sslCertPath = defaultSettings.sslCertPemPath;
20-
const _commitConfig = defaultSettings.commitConfig;
21-
const _attestationConfig = defaultSettings.attestationConfig;
22-
const _privateOrganizations = defaultSettings.privateOrganizations;
23-
const _urlShortener = defaultSettings.urlShortener;
24-
const _contactEmail = defaultSettings.contactEmail;
25-
const _csrfProtection = defaultSettings.csrfProtection;
20+
let _commitConfig = defaultSettings.commitConfig;
21+
let _attestationConfig = defaultSettings.attestationConfig;
22+
let _privateOrganizations = defaultSettings.privateOrganizations;
23+
let _urlShortener = defaultSettings.urlShortener;
24+
let _contactEmail = defaultSettings.contactEmail;
25+
let _csrfProtection = defaultSettings.csrfProtection;
2626

2727
// Get configured proxy URL
2828
const getProxyUrl = () => {
@@ -114,31 +114,49 @@ const getSessionMaxAgeHours = () => {
114114

115115
// Get commit related configuration
116116
const getCommitConfig = () => {
117+
if (_userSettings && _userSettings.commitConfig) {
118+
_commitConfig = _userSettings.commitConfig;
119+
}
117120
return _commitConfig;
118121
};
119122

120123
// Get attestation related configuration
121124
const getAttestationConfig = () => {
125+
if (_userSettings && _userSettings.attestationConfig) {
126+
_attestationConfig = _userSettings.attestationConfig;
127+
}
122128
return _attestationConfig;
123129
};
124130

125131
// Get private organizations related configuration
126132
const getPrivateOrganizations = () => {
133+
if (_userSettings && _userSettings.privateOrganizations) {
134+
_privateOrganizations = _userSettings.privateOrganizations;
135+
}
127136
return _privateOrganizations;
128137
};
129138

130139
// Get URL shortener
131140
const getURLShortener = () => {
141+
if (_userSettings && _userSettings.urlShortener) {
142+
_urlShortener = _userSettings.urlShortener;
143+
}
132144
return _urlShortener;
133145
};
134146

135147
// Get contact e-mail address
136148
const getContactEmail = () => {
149+
if (_userSettings && _userSettings.contactEmail) {
150+
_contactEmail = _userSettings.contactEmail;
151+
}
137152
return _contactEmail;
138153
};
139154

140155
// Get CSRF protection flag
141156
const getCSRFProtection = () => {
157+
if (_userSettings && _userSettings.csrfProtection) {
158+
_csrfProtection = _userSettings.csrfProtection;
159+
}
142160
return _csrfProtection;
143161
};
144162

@@ -147,7 +165,7 @@ const getSSLKeyPath = () => {
147165
_sslKeyPath = _userSettings.sslKeyPemPath;
148166
}
149167
if (!_sslKeyPath) {
150-
return "../../certs/key.pem";
168+
return '../../certs/key.pem';
151169
}
152170
return _sslKeyPath;
153171
};
@@ -157,7 +175,7 @@ const getSSLCertPath = () => {
157175
_sslCertPath = _userSettings.sslCertPemPath;
158176
}
159177
if (!_sslCertPath) {
160-
return "../../certs/cert.pem";
178+
return '../../certs/cert.pem';
161179
}
162180
return _sslCertPath;
163181
};
@@ -178,4 +196,4 @@ exports.getURLShortener = getURLShortener;
178196
exports.getContactEmail = getContactEmail;
179197
exports.getCSRFProtection = getCSRFProtection;
180198
exports.getSSLKeyPath = getSSLKeyPath;
181-
exports.getSSLCertPath = getSSLCertPath;
199+
exports.getSSLCertPath = getSSLCertPath;

0 commit comments

Comments
 (0)