From c6e0ad75b9f7a603853314c2d7339c2be3ed762b Mon Sep 17 00:00:00 2001 From: Oliver Gorwits Date: Wed, 8 Mar 2023 14:15:12 +0000 Subject: [PATCH] #985 allow netdisco-{deploy,do,db-deploy} on custom tenant with NETDISCO_DB_TENANT --- lib/App/Netdisco/Configuration.pm | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/App/Netdisco/Configuration.pm b/lib/App/Netdisco/Configuration.pm index cf675418..278864cd 100644 --- a/lib/App/Netdisco/Configuration.pm +++ b/lib/App/Netdisco/Configuration.pm @@ -97,6 +97,13 @@ if (ref {} eq ref setting('database')) { # and support tenancies by setting what the default schema points to setting('plugins')->{DBIC}->{'netdisco'}->{'alias'} = 'default'; + + # allow override of the default tenancy + setting('plugins')->{DBIC}->{'default'} + = setting('plugins')->{DBIC}->{$ENV{NETDISCO_DB_TENANT}} + if $ENV{NETDISCO_DB_TENANT} + and $ENV{NETDISCO_DB_TENANT} ne 'netdisco' + and exists setting('plugins')->{DBIC}->{$ENV{NETDISCO_DB_TENANT}}; } # always set this