Merge pull request #248 from IDevJoe/master

Remove fatal error from docker secrets
This commit is contained in:
pawelmalak 2021-12-17 11:30:19 +01:00 committed by GitHub
commit 9dd3bd1f53
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 13 deletions

13
package-lock.json generated
View file

@ -13,7 +13,7 @@
"@types/express": "^4.17.13",
"axios": "^0.24.0",
"concurrently": "^6.3.0",
"docker-secret": "^1.2.3",
"docker-secret": "idevjoe/docker-secret#1.2.4",
"dotenv": "^10.0.0",
"express": "^4.17.1",
"jsonwebtoken": "^8.5.1",
@ -1192,8 +1192,8 @@
},
"node_modules/docker-secret": {
"version": "1.2.3",
"resolved": "https://registry.npmjs.org/docker-secret/-/docker-secret-1.2.3.tgz",
"integrity": "sha512-JFUGiZEiNO0Hi9YzZAdCc5MwUpgQOjz0OeZkkcEv+lH6ZBkXNK97w2gcBQCsg5WRsT+Cj9eKFhuYyDxT8j56+A==",
"resolved": "git+ssh://git@github.com/idevjoe/docker-secret.git#556bce1313193c1a599767e2651f50730b934f86",
"license": "MIT",
"engines": {
"node": ">= 6"
}
@ -5335,9 +5335,8 @@
}
},
"docker-secret": {
"version": "1.2.3",
"resolved": "https://registry.npmjs.org/docker-secret/-/docker-secret-1.2.3.tgz",
"integrity": "sha512-JFUGiZEiNO0Hi9YzZAdCc5MwUpgQOjz0OeZkkcEv+lH6ZBkXNK97w2gcBQCsg5WRsT+Cj9eKFhuYyDxT8j56+A=="
"version": "git+ssh://git@github.com/idevjoe/docker-secret.git#556bce1313193c1a599767e2651f50730b934f86",
"from": "docker-secret@idevjoe/docker-secret#1.2.4"
},
"dot-prop": {
"version": "5.3.0",
@ -7754,4 +7753,4 @@
"integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w=="
}
}
}
}

View file

@ -21,7 +21,7 @@
"@types/express": "^4.17.13",
"axios": "^0.24.0",
"concurrently": "^6.3.0",
"docker-secret": "^1.2.3",
"docker-secret": "idevjoe/docker-secret#1.2.4",
"dotenv": "^10.0.0",
"express": "^4.17.1",
"jsonwebtoken": "^8.5.1",

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');
}
};