mirror of
https://github.com/Cameri/nostream.git
synced 2025-08-09 04:31:59 +02:00
feat: fallback to PORT env var when listening
Signed-off-by: Ricardo Arturo Cabral Mejía <me@ricardocabral.io>
This commit is contained in:
@@ -12,7 +12,7 @@ RUN npm run build
|
||||
|
||||
FROM node:18-alpine3.16
|
||||
|
||||
LABEL org.opencontainers.image.title="Nostr Typescript Relay"
|
||||
LABEL org.opencontainers.image.title="Nostream"
|
||||
LABEL org.opencontainers.image.source=https://github.com/Cameri/nostream
|
||||
LABEL org.opencontainers.image.description="nostream"
|
||||
LABEL org.opencontainers.image.authors="Ricardo Arturo Cabral Mejía"
|
||||
|
@@ -19,9 +19,8 @@ export class AppWorker implements IRunnable {
|
||||
}
|
||||
|
||||
public run(): void {
|
||||
const port = Number(process.env.RELAY_PORT) || 8008
|
||||
|
||||
this.adapter.listen(port)
|
||||
const port = process.env.RELAY_PORT ?? process.env.PORT ?? 8008
|
||||
this.adapter.listen(typeof port === 'number' ? port : Number(port))
|
||||
}
|
||||
|
||||
private onMessage(message: { eventName: string, event: unknown }): void {
|
||||
|
6
src/cache/client.ts
vendored
6
src/cache/client.ts
vendored
@@ -1,5 +1,9 @@
|
||||
import { createClient, RedisClientOptions } from 'redis'
|
||||
import { CacheClient } from '../@types/cache'
|
||||
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}`,
|
||||
@@ -11,7 +15,7 @@ let instance: CacheClient | undefined = undefined
|
||||
export const getCacheClient = (): CacheClient => {
|
||||
if (!instance) {
|
||||
const config = getCacheConfig()
|
||||
|
||||
debug('config: %o', config)
|
||||
instance = createClient(config)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user