fix: support database port
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
68e4b27300
commit
8d48d4d458
@ -25,6 +25,7 @@ $ docker run \
|
||||
--rm \
|
||||
--env DATABASE_TYPE: Pg \
|
||||
--env DATABASE_HOST: postgres \
|
||||
--env DATABASE_PORT: 5432 \
|
||||
--env DATABASE_NAME: postgres \
|
||||
--env DATABASE_USER: fetchmail \
|
||||
--env DATABASE_PASSWORD: MySecretPassword \
|
||||
@ -39,6 +40,7 @@ $ docker run \
|
||||
--rm \
|
||||
--env DATABASE_TYPE: my \
|
||||
--env DATABASE_HOST: root \
|
||||
--env DATABASE_PORT: 3306 \
|
||||
--env DATABASE_NAME: mysql \
|
||||
--env DATABASE_USER: fetchmail \
|
||||
--env DATABASE_PASSWORD: MySecretPassword \
|
||||
@ -62,6 +64,7 @@ services:
|
||||
environment:
|
||||
- DATABASE_TYPE=${DATABASE_TYPE}
|
||||
- DATABASE_HOST=${DATABASE_HOST}
|
||||
- DATABASE_HOST=${DATABASE_PORT}
|
||||
- DATABASE_NAME=${DATABASE_NAME}
|
||||
- DATABASE_USER=${DATABASE_USER}
|
||||
- DATABASE_PASSWORD=${DATABASE_PASSWORD}
|
||||
|
@ -15,10 +15,11 @@ use LockFile::Simple qw(lock trylock unlock);
|
||||
|
||||
# database backend - uncomment one of these
|
||||
our $db_type=$ENV{'DATABASE_TYPE'};
|
||||
our $db_host=$ENV{'DATABASE_HOST'};
|
||||
our $db_name=$ENV{'DATABASE_NAME'};
|
||||
our $db_username=$ENV{'DATABASE_USER'};
|
||||
our $db_password=$ENV{'DATABASE_PASSWORD'};
|
||||
our $db_host=$ENV{'DATABASE_HOST'};
|
||||
our $db_port=$ENV{'DATABASE_PORT'};
|
||||
our $db_name=$ENV{'DATABASE_NAME'};
|
||||
|
||||
# instead of changing this script, you can put your settings to /etc/mail/postfixadmin/fetchmail.conf
|
||||
# just use perl syntax there to fill the variables listed above (without the "our" keyword). Example:
|
||||
@ -60,7 +61,7 @@ if (-e $configfile) {
|
||||
}
|
||||
|
||||
if($db_type eq "Pg" || $db_type eq "mysql") {
|
||||
$dsn = "DBI:$db_type:database=$db_name;host=$db_host";
|
||||
$dsn = "DBI:$db_type:database=$db_name;host=$db_host;port=$db_port";
|
||||
} else {
|
||||
log_and_die "unsupported db_type $db_type";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user