MCPcopy
hub / github.com/jaakkopasanen/AutoEq / getHttpsConfig

Function getHttpsConfig

webapp/ui/config/getHttpsConfig.js:48–64  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

46// Get the https config
47// Return cert files if provided in env, otherwise just true or false
48function getHttpsConfig() {
49 const { SSL_CRT_FILE, SSL_KEY_FILE, HTTPS } = process.env;
50 const isHttps = HTTPS === 'true';
51
52 if (isHttps && SSL_CRT_FILE && SSL_KEY_FILE) {
53 const crtFile = path.resolve(paths.appPath, SSL_CRT_FILE);
54 const keyFile = path.resolve(paths.appPath, SSL_KEY_FILE);
55 const config = {
56 cert: readEnvFile(crtFile, 'SSL_CRT_FILE'),
57 key: readEnvFile(keyFile, 'SSL_KEY_FILE'),
58 };
59
60 validateKeyAndCerts({ ...config, keyFile, crtFile });
61 return config;
62 }
63 return isHttps;
64}
65
66module.exports = getHttpsConfig;

Callers 1

Calls 3

readEnvFileFunction · 0.85
validateKeyAndCertsFunction · 0.85
resolveMethod · 0.45

Tested by

no test coverage detected