diff --git a/infrastructure_files/configure.sh b/infrastructure_files/configure.sh index f04735de6..bf021c9ac 100755 --- a/infrastructure_files/configure.sh +++ b/infrastructure_files/configure.sh @@ -41,6 +41,18 @@ if [[ "x-$NETBIRD_DOMAIN" == "x-" ]]; then exit 1 fi +# Check if PostgreSQL is set as the store engine +if [[ "$NETBIRD_STORE_CONFIG_ENGINE" == "postgres" ]]; then + # Exit if 'NETBIRD_STORE_ENGINE_POSTGRES_DSN' is not set + if [[ -z "$NETBIRD_STORE_ENGINE_POSTGRES_DSN" ]]; then + echo "Warning: NETBIRD_STORE_CONFIG_ENGINE=postgres but NETBIRD_STORE_ENGINE_POSTGRES_DSN is not set." + echo "Please add the following line to your setup.env file:" + echo 'NETBIRD_STORE_ENGINE_POSTGRES_DSN="host= user= password= dbname= port="' + exit 1 + fi + export NETBIRD_STORE_ENGINE_POSTGRES_DSN +fi + # local development or tests if [[ $NETBIRD_DOMAIN == "localhost" || $NETBIRD_DOMAIN == "127.0.0.1" ]]; then export NETBIRD_MGMT_SINGLE_ACCOUNT_MODE_DOMAIN="netbird.selfhosted" diff --git a/infrastructure_files/docker-compose.yml.tmpl b/infrastructure_files/docker-compose.yml.tmpl index 6b6831493..43c8b470c 100644 --- a/infrastructure_files/docker-compose.yml.tmpl +++ b/infrastructure_files/docker-compose.yml.tmpl @@ -77,6 +77,9 @@ services: options: max-size: "500m" max-file: "2" + environment: + - NETBIRD_STORE_ENGINE_POSTGRES_DSN=$NETBIRD_STORE_ENGINE_POSTGRES_DSN + # Coturn coturn: image: coturn/coturn:$COTURN_TAG diff --git a/infrastructure_files/docker-compose.yml.tmpl.traefik b/infrastructure_files/docker-compose.yml.tmpl.traefik index d3ae6529a..c4415d848 100644 --- a/infrastructure_files/docker-compose.yml.tmpl.traefik +++ b/infrastructure_files/docker-compose.yml.tmpl.traefik @@ -81,7 +81,9 @@ services: - traefik.http.routers.netbird-management.service=netbird-management - traefik.http.services.netbird-management.loadbalancer.server.port=443 - traefik.http.services.netbird-management.loadbalancer.server.scheme=h2c - + environment: + - NETBIRD_STORE_ENGINE_POSTGRES_DSN=$NETBIRD_STORE_ENGINE_POSTGRES_DSN + # Coturn coturn: image: coturn/coturn:$COTURN_TAG