diff --git a/README.md b/README.md index d65cc81..0e763dd 100644 --- a/README.md +++ b/README.md @@ -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} diff --git a/fetchmail.pl b/fetchmail.pl index 18eff1f..b1c6fdd 100755 --- a/fetchmail.pl +++ b/fetchmail.pl @@ -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"; }