r3-team / r3_docker

REI3 dockerfile
MIT License
6 stars 3 forks source link

Db patch 1 #4

Closed howardshand closed 8 months ago

howardshand commented 8 months ago

Suggesting to make the password editable in the r3 config.json.

r3-gabriel commented 8 months ago

That is not a bad idea - how about also setting DB name & user via environment parameters and then passing r3_db_name, r3_db_pass & r3_db_user as args:

r3_db:
    container_name: r${R3_VERSION:-3.7.3}_db
    environment:
                POSTGRES_DB: ${R3_DB_NAME:-app}
        POSTGRES_PASSWORD: ${R3_DB_PASS:-app}
        POSTGRES_USER: ${R3_DB_USER:-app}
[...]
r3:
    build:
        context: https://github.com/r3-team/r3_docker.git#main
        args:
            r3_db_host: r3_db
            r3_db_name: ${R3_DB_NAME:-app}
            r3_db_pass: ${R3_DB_PASS:-app}
            r3_db_user: ${R3_DB_USER:-app}
            r3_os_arch: arm64
            r3_version: ${R3_VERSION:-3.7.3}
            im_policy: /etc/ImageMagick-6/policy.xml
ARG r3_db_host
ARG r3_db_name
ARG r3_db_pass
ARG r3_db_user
ARG r3_os_arch
ARG r3_version
ARG im_policy
&& sed -i "s/\"name\": \"app\"/\"name\": \"${r3_db_name}\"/g" config_template.json \
&& sed -i "s/\"pass\": \"app\"/\"pass\": \"${r3_db_pass}\"/g" config_template.json \
&& sed -i "s/\"user\": \"app\"/\"user\": \"${r3_db_user}\"/g" config_template.json \

I´d prefer if we´d name args consistently, so r3_db_pass instead of db_pass (similar to r3_db_host).

howardshand commented 8 months ago

Thanks