-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Jason C. Leach <[email protected]>
- Loading branch information
Showing
17 changed files
with
190 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,5 @@ DS_Store | |
build | ||
node_modules | ||
.env | ||
.env.local | ||
.env.local | ||
.pnpm-store/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import path from 'node:path' | ||
import { LogLevel } from '@credo-ts/core' | ||
import dotenv from 'dotenv' | ||
import nconf from 'nconf' | ||
|
||
const dirName = __dirname | ||
const configFileName = 'config.json' | ||
const env = process.env.NODE_ENV ?? 'development' | ||
|
||
if (env === 'development') { | ||
dotenv.config() | ||
} | ||
|
||
/** | ||
* These settings contain sensitive information and should not be | ||
* stored in the repo. They are extracted from environment variables | ||
* and added to the config. | ||
*/ | ||
|
||
const agentPort = Number(process.env.AGENT_PORT ?? 3110) | ||
|
||
// overrides are always as defined | ||
nconf.overrides({ | ||
db: { | ||
host: process.env.POSTGRES_HOST, | ||
user: process.env.POSTGRES_USER, | ||
password: process.env.POSTGRES_PASSWORD, | ||
adminUser: process.env.POSTGRES_ADMIN_USER, | ||
adminPassword: process.env.POSTGRES_ADMIN_PASSWORD, | ||
}, | ||
agent: { | ||
port: agentPort, | ||
endpoints: process.env.AGENT_ENDPOINTS | ||
? process.env.AGENT_ENDPOINTS.split(',') | ||
: [`http://localhost:${agentPort}`, `ws://localhost:${agentPort}`], | ||
name: process.env.AGENT_NAME ?? 'My Mediator', | ||
invitationUrl: process.env.INVITATION_URL, | ||
logLevel: process.env.LOG_LEVEL ?? LogLevel.debug, | ||
usePushNotifications: process.env.USE_PUSH_NOTIFICATIONS === 'true', | ||
notificationWebhookUrl: process.env.NOTIFICATION_WEBHOOK_URL, | ||
}, | ||
wallet: { | ||
name: process.env.WALLET_NAME ?? 'mediator-dev', | ||
key: process.env.WALLET_KEY ?? 'blarbzzz', | ||
}, | ||
}) | ||
|
||
// load other properties from file. | ||
nconf | ||
.argv({ parseValues: true }) | ||
.env() | ||
.file({ file: path.join(dirName, '../', configFileName) }) | ||
|
||
// if nothing else is set, use defaults. This will be set | ||
// if they do not exist in overrides or the config file. | ||
|
||
export default nconf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +0,0 @@ | ||
import { LogLevel } from '@credo-ts/core' | ||
|
||
export const AGENT_PORT = process.env.AGENT_PORT ? Number(process.env.AGENT_PORT) : 3000 | ||
export const AGENT_NAME = process.env.AGENT_NAME || 'Credo Mediator' | ||
export const WALLET_NAME = process.env.WALLET_NAME || 'credo-mediator-dev' | ||
export const WALLET_KEY = process.env.WALLET_KEY || 'credo-mediator-dev' | ||
export const AGENT_ENDPOINTS = process.env.AGENT_ENDPOINTS?.split(',') ?? [ | ||
`http://localhost:${AGENT_PORT}`, | ||
`ws://localhost:${AGENT_PORT}`, | ||
] | ||
|
||
export const POSTGRES_HOST = process.env.POSTGRES_HOST | ||
export const POSTGRES_USER = process.env.POSTGRES_USER | ||
export const POSTGRES_PASSWORD = process.env.POSTGRES_PASSWORD | ||
export const POSTGRES_ADMIN_USER = process.env.POSTGRES_ADMIN_USER | ||
export const POSTGRES_ADMIN_PASSWORD = process.env.POSTGRES_ADMIN_PASSWORD | ||
|
||
export const INVITATION_URL = process.env.INVITATION_URL | ||
|
||
export const LOG_LEVEL = LogLevel.debug | ||
|
||
export const IS_DEV = process.env.NODE_ENV === 'development' | ||
|
||
export const USE_PUSH_NOTIFICATIONS = process.env.USE_PUSH_NOTIFICATIONS === 'true' | ||
|
||
export const NOTIFICATION_WEBHOOK_URL = process.env.NOTIFICATION_WEBHOOK_URL || 'http://localhost:5000' | ||
Oops, something went wrong.