Skip to content
This repository was archived by the owner on Mar 19, 2025. It is now read-only.
This repository was archived by the owner on Mar 19, 2025. It is now read-only.

Stop depending on automatically created environment variables #25

Open
@jpbaril

Description

@jpbaril

To work, the ttrss-configure-db.php script depends on the environment variables automatically created by the "--link" flag of the docker run command. Example: DB_PORT_5432_TCP_ADDR (

$config['DB_HOST'] = env($ename . '_PORT_' . $eport . '_TCP_ADDR');
)

Per the Docker documentation, the --link flag is a legacy feature (https://docs.docker.com/engine/userguide/networking/default_network/dockerlinks/). In addition, when creating the TTRSS and POSTGRESSQL containers with a docker-compose file instead of the run command, a bridge network is automatically created and used by these services instead of using the default bridge network. With "user-defined" networks (or docker-compose created networks), as opposed to the default bridge network, those automatic environment variables are not created even when using the "link:" config in the docker-compose file.

I think the script should be changed to use user-specified variables (DB_HOST=postgres, DB_PORT=5432, DB_TYPE=pgsql) if present in the docker-compose file, and if not, continue to be generated by the script from the legacy automatic environment variable.

I think a way of implementing this could be how it was done there around the lines 11-45 https://github.com/clue/docker-ttrss/blob/master/configure-db.php#L28

In the mean time, to make it work I just manually specified in my docker-compose file the environment variables the legacy --link flag was creating, which are:

DB_PORT=tcp://db:5432
DB_PORT_5432_TCP=tcp://db:5432
DB_PORT_5432_TCP_ADDR=db
DB_PORT_5432_TCP_PORT=5432
DB_PORT_5432_TCP_PROTO=tcp

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions