Skip to content

Commit

Permalink
build: Add ca cert env
Browse files Browse the repository at this point in the history
  • Loading branch information
DaevMithran committed May 11, 2023
1 parent 0c2213f commit 6b91e2b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ ARG NPM_CONFIG_LOGLEVEL=warn
ARG PORT=8787
ARG ISSUER_SECRET_KEY
ARG ISSUER_DATABASE_URL
ARG ISSUER_DATABASE_CERT
ARG MAINNET_RPC_URL
ARG TESTNET_RPC_URL
ARG RESOLVER_URL
Expand All @@ -30,6 +31,7 @@ ENV NPM_CONFIG_LOGLEVEL ${NPM_CONFIG_LOGLEVEL}
ENV PORT ${PORT}
ENV ISSUER_SECRET_KEY ${ISSUER_SECRET_KEY}
ENV ISSUER_DATABASE_URL ${ISSUER_DATABASE_URL}
ENV ISSUER_DATABASE_CERT ${ISSUER_DATABASE_CERT}
ENV MAINNET_RPC_URL ${MAINNET_RPC_URL}
ENV TESTNET_RPC_URL ${TESTNET_RPC_URL}
ENV RESOLVER_URL ${RESOLVER_URL}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ The application expects the following environment variables to be defined for th
5. `FEE_PAYER_MNENONIC_MAINNET`: Mnemonic for the issuer's Cosmos account to be used for mainnet.
6. `MAINNET_RPC_URL`: Optional RPC URL for a node on cheqd mainnet, e.g., `https://rpc.cheqd.net`
7. `TESTNET_RPC_URL`: Optional RPC URL for a node on cheqd testnet, e.g., `https://rpc.cheqd.network`
8. `ISSUER_DATABASE_SYNCHRONIZE`: Should be set to false the when the database is already created, its true by default
8. `ISSUER_DATABASE_CERT`: Optional ca certificate parameter of the database

### Run

Expand Down
6 changes: 4 additions & 2 deletions src/database/connection/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { CreateCustomersTable1683723285946 } from '../migrations/CreateCustomers

require('dotenv').config()

const { ISSUER_DATABASE_URL } = process.env
const { ISSUER_DATABASE_URL, ISSUER_DATABASE_CERT } = process.env

export class Connection {
public dbConnection : DataSource
Expand All @@ -26,7 +26,9 @@ export class Connection {
username: config.user,
password: config.password,
database: config.database,
ssl: config.ssl ? true : false,
ssl: config.ssl ? {
ca: ISSUER_DATABASE_CERT
} : false,
migrations: [...migrations, CreateCustomersTable1683723285946],
entities: [...Entities, CustomerEntity],
logging: ['error', 'info', 'warn']
Expand Down
1 change: 1 addition & 0 deletions src/types/environment.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ declare global {
ALLOWED_ORIGINS: string | undefined
ISSUER_DATABASE_URL: string
ISSUER_SECRET_KEY: string
ISSUER_DATABASE_CERT: string | undefined
}
}
}
Expand Down

0 comments on commit 6b91e2b

Please sign in to comment.