Skip to content

Commit

Permalink
Merge branch '357-add-docker-secret' into 'dev'
Browse files Browse the repository at this point in the history
add env for secrets in config

Closes #357

See merge request ergo/rosen-bridge/guard-service!315
  • Loading branch information
vorujack committed Jan 27, 2024
2 parents 9210039 + c355f4c commit f9fa8d4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
11 changes: 11 additions & 0 deletions docker/custom-environment-variables.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,14 @@ database:
user: 'POSTGRES_USER'
password: 'POSTGRES_PASSWORD'
name: 'POSTGRES_DB'
guard:
mnemonic: 'MNEMONIC'
tss:
secret: 'TSS_SECRET'
cardano:
koios:
authToken: 'KOIOS_AUTH_TOKEN'
blockfrost:
projectId: 'BLOCKFROST_PROJECT_ID'
overrideLokiBasicAuth: 'OVERRIDE_LOKI_BASIC_AUTH'
discordWebHookUrl: 'DISCORD_WEBHOOK_URL'
8 changes: 6 additions & 2 deletions src/configs/Configs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import Utils from '../utils/Utils';
import { ConfigError } from '../utils/errors';
import { SUPPORTED_CHAINS } from '../utils/constants';
import { TransportOptions } from '@rosen-bridge/winston-logger';
import { cloneDeep } from 'lodash-es';

/**
* reads a numerical config, set default value if it does not exits
Expand Down Expand Up @@ -158,10 +159,13 @@ class Configs {
static logs;
static {
const logs = config.get<TransportOptions[]>('logs');
const wrongLogTypeIndex = logs.findIndex((log) => {
const clonedLogs = cloneDeep(logs);
const wrongLogTypeIndex = clonedLogs.findIndex((log) => {
const logTypeValidation = ['console', 'file', 'loki'].includes(log.type);
let loggerChecks = true;
if (log.type === 'loki') {
const overrideLokiBasicAuth = getOptionalConfig('overrideLokiBasicAuth', '');
if (overrideLokiBasicAuth !== '') log.basicAuth = overrideLokiBasicAuth;
loggerChecks =
log.host != undefined &&
typeof log.host === 'string' &&
Expand All @@ -188,7 +192,7 @@ class Configs {
logs[wrongLogTypeIndex]
);
}
this.logs = logs;
this.logs = clonedLogs;
}

static discordWebHookUrl = config.get<string>('discordWebHookUrl');
Expand Down

0 comments on commit f9fa8d4

Please sign in to comment.