Skip to content

Commit

Permalink
Fix env var name for API key (#9340)
Browse files Browse the repository at this point in the history
### Description

ODIS Forno API Key env var was specified incorrectly.

### Tested

Tested in Alfajores.
  • Loading branch information
codyborn authored and martinvol committed May 13, 2022
1 parent 25908af commit 8aafe91
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ CONTEXTS=azure-odis0-centralus,azure-odis1-centralus,azure-odis2-centralus

# ODIS azure k8s deployments
ODIS_SIGNER_DOCKER_IMAGE_REPOSITORY=us.gcr.io/celo-testnet/celo-monorepo
ODIS_SIGNER_DOCKER_IMAGE_TAG=oblivious-decentralized-identifier-service-1.1.4
ODIS_SIGNER_DOCKER_IMAGE_TAG=oblivious-decentralized-identifier-service-1.1.10
ODIS_SIGNER_BLOCKCHAIN_PROVIDER=https://alfajores-forno.celo-testnet.org

# ODIS signer 0 Azure info
Expand Down
2 changes: 1 addition & 1 deletion .env.alfajores
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ CONTEXTS=azure-komenci-eastus,azure-komenci-westeu,azure-oracle-centralus,azure-

# ODIS azure k8s deployments
ODIS_SIGNER_DOCKER_IMAGE_REPOSITORY=us.gcr.io/celo-testnet/celo-monorepo
ODIS_SIGNER_DOCKER_IMAGE_TAG=oblivious-decentralized-identifier-service-1.1.8
ODIS_SIGNER_DOCKER_IMAGE_TAG=oblivious-decentralized-identifier-service-1.1.10
ODIS_SIGNER_BLOCKCHAIN_PROVIDER=https://alfajores-forno.celo-testnet.org
# Options: json, human (default), stackdriver
LOG_FORMAT=stackdriver
Expand Down
Binary file modified .env.mnemonic.alfajores.enc
Binary file not shown.
Binary file modified .env.mnemonic.baklava.enc
Binary file not shown.
Binary file modified .env.mnemonic.enc
Binary file not shown.
Binary file modified .env.mnemonic.rc1.enc
Binary file not shown.
2 changes: 1 addition & 1 deletion .env.rc1
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ VOTING_BOT_CRON_SCHEDULE="1 * * * *"

# ODIS azure k8s deployments
ODIS_SIGNER_DOCKER_IMAGE_REPOSITORY=us.gcr.io/celo-testnet/celo-monorepo
ODIS_SIGNER_DOCKER_IMAGE_TAG=oblivious-decentralized-identifier-service-1.1.8
ODIS_SIGNER_DOCKER_IMAGE_TAG=oblivious-decentralized-identifier-service-1.1.10
ODIS_SIGNER_BLOCKCHAIN_PROVIDER="https://forno.celo.org"
# Options: json, human (default), stackdriver
LOG_FORMAT=stackdriver
Expand Down
2 changes: 1 addition & 1 deletion packages/celotool/src/lib/env-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ export enum envVar {
ODIS_SIGNER_DOCKER_IMAGE_REPOSITORY = 'ODIS_SIGNER_DOCKER_IMAGE_REPOSITORY',
ODIS_SIGNER_DOCKER_IMAGE_TAG = 'ODIS_SIGNER_DOCKER_IMAGE_TAG',
ODIS_SIGNER_BLOCKCHAIN_PROVIDER = 'ODIS_SIGNER_BLOCKCHAIN_PROVIDER',
ODIS_SIGNER_BLOCKCHAIN_API_KEY = 'ODIS_SIGNER_BLOCKCHAIN_API_KEY',
ORACLE_DOCKER_IMAGE_REPOSITORY = 'ORACLE_DOCKER_IMAGE_REPOSITORY',
ORACLE_DOCKER_IMAGE_TAG = 'ORACLE_DOCKER_IMAGE_TAG',
ORACLE_UNUSED_ORACLE_ADDRESSES = 'ORACLE_UNUSED_ORACLE_ADDRESSES',
Expand Down Expand Up @@ -226,6 +225,7 @@ export enum DynamicEnvVar {
ORACLE_ADDRESS_AWS_KEY_ALIASES = '{{ context }}_{{ currencyPair }}_ORACLE_ADDRESS_AWS_KEY_ALIASES',
ORACLE_ADDRESS_AZURE_KEY_VAULTS = '{{ context }}_{{ currencyPair }}_ORACLE_ADDRESS_AZURE_KEY_VAULTS',
ORACLE_ADDRESSES_FROM_MNEMONIC_COUNT = '{{ context }}_{{ currencyPair}}_ORACLE_ADDRESSES_FROM_MNEMONIC_COUNT',
ODIS_SIGNER_BLOCKCHAIN_API_KEY = '{{ context }}_ODIS_SIGNER_BLOCKCHAIN_API_KEY',
ODIS_SIGNER_AZURE_KEYVAULT_NAME = '{{ context }}_ODIS_SIGNER_AZURE_KEYVAULT_NAME',
ODIS_SIGNER_AZURE_KEYVAULT_SECRET_NAME = '{{ context }}_ODIS_SIGNER_AZURE_KEYVAULT_SECRET_NAME',
ODIS_SIGNER_DB_HOST = '{{ context }}_ODIS_SIGNER_DB_HOST',
Expand Down
22 changes: 21 additions & 1 deletion packages/celotool/src/lib/odis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ interface ODISSignerDatabaseConfig {
password: string
}

/**
* Information for the Blockchain provider connection
*/
interface ODISSignerBlockchainConfig {
blockchainApiKey: string
}

/**
* Information for the ODIS logging
*/
Expand Down Expand Up @@ -66,6 +73,15 @@ const contextDatabaseConfigDynamicEnvVars: {
password: DynamicEnvVar.ODIS_SIGNER_DB_PASSWORD,
}

/**
* Env vars corresponding to each value for the ODISSignerBlockchainConfig for a particular context
*/
const contextBlockchainConfigDynamicEnvVars: {
[k in keyof ODISSignerBlockchainConfig]: DynamicEnvVar
} = {
blockchainApiKey: DynamicEnvVar.ODIS_SIGNER_BLOCKCHAIN_API_KEY,
}

/**
* Env vars corresponding to each value for the logging for a particular context
*/
Expand Down Expand Up @@ -114,6 +130,10 @@ export async function removeHelmRelease(celoEnv: string, context: string) {
}

async function helmParameters(celoEnv: string, context: string) {
const blockchainConfig = getContextDynamicEnvVarValues(
contextBlockchainConfigDynamicEnvVars,
context
)
const databaseConfig = getContextDynamicEnvVarValues(contextDatabaseConfigDynamicEnvVars, context)
const keyVaultConfig = getContextDynamicEnvVarValues(
contextODISSignerKeyVaultConfigDynamicEnvVars,
Expand All @@ -140,7 +160,7 @@ async function helmParameters(celoEnv: string, context: string) {
`--set keystore.vaultName=${keyVaultConfig.vaultName}`,
`--set keystore.secretName=${keyVaultConfig.secretName}`,
`--set blockchainProvider=${fetchEnv(envVar.ODIS_SIGNER_BLOCKCHAIN_PROVIDER)}`,
`--set blockchainApiKey=${fetchEnv(envVar.ODIS_SIGNER_BLOCKCHAIN_API_KEY)}`,
`--set blockchainApiKey=${blockchainConfig.blockchainApiKey}`,
`--set log.level=${loggingConfig.level}`,
`--set log.format=${loggingConfig.format}`,
].concat(await ODISSignerKeyVaultIdentityHelmParameters(context, keyVaultConfig))
Expand Down

0 comments on commit 8aafe91

Please sign in to comment.