Remove fatal error from docker secrets

This commit fixes #242 by catching the error thrown by getSecrets(). The underlying issue exists in docker-secret and has to do with the serviceAccount secret installed automatically by kubernetes.
This commit is contained in:
Joe Longendyke 2021-12-06 12:37:28 +09:00
parent b08181e712
commit a536ad49ea
No known key found for this signature in database
GPG key ID: A24E92202E5DEA61
2 changed files with 10 additions and 6 deletions

2
package-lock.json generated
View file

@ -7754,4 +7754,4 @@
"integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w=="
}
}
}
}

View file

@ -3,14 +3,18 @@ const Logger = require('../Logger');
const logger = new Logger();
const initDockerSecrets = () => {
const secrets = getSecrets();
try {
const secrets = getSecrets();
for (const property in secrets) {
const upperProperty = property.toUpperCase();
for (const property in secrets) {
const upperProperty = property.toUpperCase();
process.env[upperProperty] = secrets[property];
process.env[upperProperty] = secrets[property];
logger.log(`${upperProperty} was overwritten with docker secret value`);
logger.log(`${upperProperty} was overwritten with docker secret value`);
}
} catch(e) {
logger.log('Failed to initialize docker secrets. Error: ' + e, 'ERROR');
}
};