podman-compose/tests/env-file-tests
Genzer 67ce900885 Commit .env in tests/env-file-tests, bypassing root .gitignore
This commit adds a .gitignore in tests/env-file-tests to allow .env files
to be committed.

Fix: #937
Signed-off-by: Genzer <732937+Genzer@users.noreply.github.com>
2024-06-24 23:29:57 +03:00
..
env-files pytests: Add tests for several multi-line environment files 2024-05-29 00:09:15 +03:00
project Commit .env in tests/env-file-tests, bypassing root .gitignore 2024-06-24 23:29:57 +03:00
.env Commit .env in tests/env-file-tests, bypassing root .gitignore 2024-06-24 23:29:57 +03:00
.gitignore Commit .env in tests/env-file-tests, bypassing root .gitignore 2024-06-24 23:29:57 +03:00
README.md Load .env from Compose file's directory and cwd 2024-06-24 23:29:56 +03:00

running the following commands should always give podman-rocks-123

podman-compose -f project/container-compose.yaml --env-file env-files/project-1.env up
podman-compose -f $(pwd)/project/container-compose.yaml --env-file $(pwd)/env-files/project-1.env up
podman-compose -f $(pwd)/project/container-compose.env-file-flat.yaml up
podman-compose -f $(pwd)/project/container-compose.env-file-obj.yaml up
podman-compose -f $(pwd)/project/container-compose.env-file-obj-optional.yaml up

based on environment variable precedent this command should give podman-rocks-321

ZZVAR1=podman-rocks-321 podman-compose -f $(pwd)/project/container-compose.yaml --env-file $(pwd)/env-files/project-1.env up

The below test should print three environment variables

podman-compose -f $(pwd)/project/container-compose.load-.env-in-project.yaml run --rm app

ZZVAR1=This value is overwritten by env-file-tests/.env
ZZVAR2=This value is loaded from .env in project/ directory
ZZVAR3=This value is loaded from env-file-tests/.env