Skip to content

Commit

Permalink
feat: Update .envs (#238)
Browse files Browse the repository at this point in the history
* feat: Update .envs

* build: Update dockerfile
  • Loading branch information
DaevMithran authored May 31, 2023
1 parent 1a1cc9d commit ce0e57b
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 11 deletions.
17 changes: 11 additions & 6 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
MAINNET_RPC_URL=https://rpc.cheqd.net:443
TESTNET_RPC_URL=https://rpc.cheqd.network:443
RESOLVER_URL="https://resolver.cheqd.net/1.0/identifiers/"
ALLOWED_ORIGINS="http://localhost:8787"

# Database
DB_CONNECTION_URL=postgres://logto:password@localhost:5432/logto
DB_ENCRYPTION_KEY="<db-encryption-key>"
# ISSUER_DATABASE_CERT="certs/issuer.crt"

RESOLVER_URL="https://resolver.cheqd.net/1.0/identifiers/"

# OpenId
OIDC_JWKS_ENDPOINT='http://localhost:3001/oidc/jwks'
OIDC_ISSUER='http://localhost:3001/oidc'

# Root endpoint for credential service backend
AUDIENCE_ENDPOINT='http://localhost:8787/1.0/api/'


# Authentication
ENABLE_AUTH="boolean,default:false"
CUSTOMER_ID="default customer id"
CUSTOMER_ID="default customer id"

# verida
USE_VERIDA_CONNECTOR="false"
VERIDA_PRIVATE_KEY="akjvncanv....avoa"
POLYGON_PRIVATE_KEY="alnvca...dvncioa"
VERIDA_NETWORK="testnet"
16 changes: 16 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,14 @@ ARG ALLOWED_ORIGINS
ARG OIDC_JWKS_ENDPOINT
ARG AUDIENCE_ENDPOINT
ARG OIDC_ISSUER
# Authentication
ARG ENABLE_AUTH
ARG CUSTOMER_ID
# verida
ARG USE_VERIDA_CONNECTOR
ARG VERIDA_PRIVATE_KEY
ARG POLYGON_PRIVATE_KEY
ARG VERIDA_NETWORK

# Run-time environment variables
ENV NPM_CONFIG_LOGLEVEL ${NPM_CONFIG_LOGLEVEL}
Expand All @@ -69,6 +77,14 @@ ENV ALLOWED_ORIGINS ${ALLOWED_ORIGINS}
ENV OIDC_JWKS_ENDPOINT ${OIDC_JWKS_ENDPOINT}
ENV AUDIENCE_ENDPOINT ${AUDIENCE_ENDPOINT}
ENV OIDC_ISSUER ${OIDC_ISSUER}
# Authentication
ENV ENABLE_AUTH ${ENABLE_AUTH}
ENV CUSTOMER_ID ${CUSTOMER_ID}
# verida
ENV USE_VERIDA_CONNECTOR ${USE_VERIDA_CONNECTOR}
ENV VERIDA_PRIVATE_KEY ${VERIDA_PRIVATE_KEY}
ENV POLYGON_PRIVATE_KEY ${POLYGON_PRIVATE_KEY}
ENV VERIDA_NETWORK ${VERIDA_NETWORK}

# Specify default port
EXPOSE ${PORT}
Expand Down
6 changes: 3 additions & 3 deletions src/services/connectors/verida.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import { Context, Network } from '@verida/client-ts'
import { AutoAccount } from '@verida/account-node'

import { CredentialDataRecord, DataRecord } from '../../types/verida.js'
import { POLYGON_RPC_URL, VC_CONTEXT, VERIDA_CREDENTIAL_RECORD_SCHEMA } from '../../types/constants.js'
import { POLYGON_RPC_URL, VC_CONTEXT, VERIDA_APP_NAME, VERIDA_CREDENTIAL_RECORD_SCHEMA } from '../../types/constants.js'

import * as dotenv from 'dotenv'
import { VerifiableCredential } from '@veramo/core'
dotenv.config()

const { VERIDA_NETWORK, VERIDA_APP_NAME, ISSUER_VERIDA_PRIVATE_KEY, POLYGON_PRIVATE_KEY } = process.env
const { VERIDA_NETWORK, VERIDA_PRIVATE_KEY, POLYGON_PRIVATE_KEY } = process.env

/**
* Helper class for the Verida protocol.
Expand Down Expand Up @@ -77,7 +77,7 @@ export class VeridaService {
await VeridaService.instance.init(
VERIDA_NETWORK,
VERIDA_APP_NAME,
ISSUER_VERIDA_PRIVATE_KEY,
VERIDA_PRIVATE_KEY,
POLYGON_PRIVATE_KEY
)
}
Expand Down
1 change: 1 addition & 0 deletions src/types/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export const CORS_ERROR_MSG = 'The CORS policy for this site does not allow acce

// verida
export const POLYGON_RPC_URL = 'https://rpc-mumbai.maticvigil.com'
export const VERIDA_APP_NAME = 'Cheqd Verida'

// Schema to store a Verifiable Credential on the Verida Network.
export const VERIDA_CREDENTIAL_RECORD_SCHEMA =
Expand Down
3 changes: 1 addition & 2 deletions src/types/environment.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ declare global {

// verida
USE_VERIDA_CONNECTOR: boolean
VERIDA_APP_NAME: string
ISSUER_VERIDA_PRIVATE_KEY: string
VERIDA_PRIVATE_KEY: string
POLYGON_PRIVATE_KEY: string
VERIDA_NETWORK: EnvironmentType

Expand Down

0 comments on commit ce0e57b

Please sign in to comment.