From 6ee722111792a76aa5e1c8d42a28103cafc38e39 Mon Sep 17 00:00:00 2001 From: Girish Ramakrishnan Date: Wed, 24 Jun 2020 10:48:04 -0700 Subject: [PATCH] Add database.name config option If database.name is set, we use it as the complete database name. If unset, we use the "peertube"+database.suffix as the complete database name. Fixes #1620 --- config/default.yaml | 2 +- config/production.yaml.example | 2 +- server/initializers/config.ts | 2 +- support/docker/production/config/production.yaml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/config/default.yaml b/config/default.yaml index 050019670..a3df1bd45 100644 --- a/config/default.yaml +++ b/config/default.yaml @@ -33,7 +33,7 @@ rates_limit: trust_proxy: - 'loopback' -# Your database name will be "peertube"+database.suffix +# Your database name will be database.name OR "peertube"+database.suffix database: hostname: 'localhost' port: 5432 diff --git a/config/production.yaml.example b/config/production.yaml.example index 6f658e61a..a494bdb03 100644 --- a/config/production.yaml.example +++ b/config/production.yaml.example @@ -32,7 +32,7 @@ rates_limit: trust_proxy: - 'loopback' -# Your database name will be "peertube"+database.suffix +# Your database name will be database.name OR "peertube"+database.suffix database: hostname: 'localhost' port: 5432 diff --git a/server/initializers/config.ts b/server/initializers/config.ts index 5b402dd74..48e2cbc1a 100644 --- a/server/initializers/config.ts +++ b/server/initializers/config.ts @@ -20,7 +20,7 @@ const CONFIG = { HOSTNAME: config.get('listen.hostname') }, DATABASE: { - DBNAME: 'peertube' + config.get('database.suffix'), + DBNAME: config.has('database.name') ? config.get('database.name') : 'peertube' + config.get('database.suffix'), HOSTNAME: config.get('database.hostname'), PORT: config.get('database.port'), USERNAME: config.get('database.username'), diff --git a/support/docker/production/config/production.yaml b/support/docker/production/config/production.yaml index 58b41a493..4eeca4110 100644 --- a/support/docker/production/config/production.yaml +++ b/support/docker/production/config/production.yaml @@ -26,7 +26,7 @@ trust_proxy: - 'linklocal' - 'uniquelocal' -# Your database name will be "peertube"+database.suffix +# Your database name will be database.name or "peertube"+database.suffix database: hostname: 'postgres' port: 5432