mirror of
https://github.com/Cameri/nostream.git
synced 2025-03-17 21:31:48 +01:00
feat: added uri string for redis and postgres
This commit is contained in:
parent
39d69e153d
commit
1475d65b41
@ -9,6 +9,7 @@ The following environment variables can be set:
|
||||
| RELAY_PORT | Relay's server port | 8008 |
|
||||
| RELAY_PRIVATE_KEY | Relay's private key in hex | (auto-generated) |
|
||||
| WORKER_COUNT | Number of workers override | No. of available CPUs |
|
||||
| DB_URI | PostgreSQL URI (overrides DB_HOST, DB_PORT, etc.) | |
|
||||
| DB_HOST | PostgresSQL Hostname | |
|
||||
| DB_PORT | PostgreSQL Port | 5432 |
|
||||
| DB_USER | PostgreSQL Username | nostr_ts_relay |
|
||||
@ -30,6 +31,7 @@ The following environment variables can be set:
|
||||
| TOR_CONTROL_PORT | Tor control Port | 9051 |
|
||||
| TOR_PASSWORD | Tor control password | nostr_ts_relay |
|
||||
| HIDDEN_SERVICE_PORT | Tor hidden service port | 80 |
|
||||
| REDIS_URI | Redis URI (overrides REDIS_HOST, REDIS_PORT, etc.) | |
|
||||
| REDIS_HOST | | |
|
||||
| REDIS_PORT | Redis Port | 6379 |
|
||||
| REDIS_USER | Redis User | default |
|
||||
|
11
README.md
11
README.md
@ -179,11 +179,18 @@ The logs can be viewed with:
|
||||
Set the following environment variables:
|
||||
|
||||
```
|
||||
DB_URI="postgresql://postgres:postgres@localhost:5432/nostr_ts_relay_test"
|
||||
|
||||
or
|
||||
|
||||
DB_HOST=localhost
|
||||
DB_PORT=5432
|
||||
DB_NAME=nostr_ts_relay
|
||||
DB_USER=postgres
|
||||
DB_PASSWORD=postgres
|
||||
|
||||
REDIS_URI="redis://default:nostr_ts_relay@localhost:6379"
|
||||
|
||||
REDIS_HOST=localhost
|
||||
REDIS_PORT=6379
|
||||
REDIS_USER=default
|
||||
@ -315,6 +322,10 @@ Open a terminal and change to the project's directory:
|
||||
Set the following environment variables:
|
||||
|
||||
```
|
||||
DB_URI="postgresql://postgres:postgres@localhost:5432/nostr_ts_relay_test"
|
||||
|
||||
or
|
||||
|
||||
DB_HOST=localhost
|
||||
DB_PORT=5432
|
||||
DB_NAME=nostr_ts_relay_test
|
||||
|
@ -1,6 +1,6 @@
|
||||
module.exports = {
|
||||
client: 'pg',
|
||||
connection: {
|
||||
connection: process.env.DATABASE_URI ? process.env.DATABASE_URI : {
|
||||
host: process.env.DB_HOST ?? 'localhost',
|
||||
port: process.env.DB_PORT ?? 5432,
|
||||
user: process.env.DB_USER ?? 'postgres',
|
||||
|
2
src/cache/client.ts
vendored
2
src/cache/client.ts
vendored
@ -6,7 +6,7 @@ import { createLogger } from '../factories/logger-factory'
|
||||
const debug = createLogger('cache-client')
|
||||
|
||||
export const getCacheConfig = (): RedisClientOptions => ({
|
||||
url: `redis://${process.env.REDIS_USER}:${process.env.REDIS_PASSWORD}@${process.env.REDIS_HOST}:${process.env.REDIS_PORT}`,
|
||||
url: process.env.REDIS_URI ? process.env.REDIS_URI : `redis://${process.env.REDIS_USER}:${process.env.REDIS_PASSWORD}@${process.env.REDIS_HOST}:${process.env.REDIS_PORT}`,
|
||||
password: process.env.REDIS_PASSWORD,
|
||||
})
|
||||
|
||||
|
@ -25,7 +25,7 @@ import { createLogger } from '../factories/logger-factory'
|
||||
const getMasterConfig = (): Knex.Config => ({
|
||||
tag: 'master',
|
||||
client: 'pg',
|
||||
connection: {
|
||||
connection: process.env.DB_URI ? process.env.DB_URI : {
|
||||
host: process.env.DB_HOST,
|
||||
port: Number(process.env.DB_PORT),
|
||||
user: process.env.DB_USER,
|
||||
|
Loading…
x
Reference in New Issue
Block a user