Skip to content

[3.0] Reads .env in the dev scripts, as docker compose does - #9723

Merged
live627 merged 1 commit into
SimpleMachines:release-3.0from
albertlast:3.0/dev-scripts-read-env
Oct 2, 2026
Merged

live627 merged 1 commit into
SimpleMachines:release-3.0from
albertlast:3.0/dev-scripts-read-env

Conversation

@albertlast

@albertlast albertlast commented Sep 30, 2026 •

Copy link
Copy Markdown
Collaborator

Description

compose.yaml takes its host ports, credentials and SMF_DB_TYPE from .env, and .dev/lib.sh says SMF_RUNNER can be set there too ("Pass --docker, or set this in .env, for the stack"). .dev/README.md says the same ("If you work in the Docker stack, put this in .env once"). But nothing in .dev/ ever reads the file. The scripts use their own defaults unless the same variables are exported in the shell.

The case that bites is running a second stack beside the first, which .docker/env.example invites. With WEB_PORT=8480 in .env, the stack serves on 8480, but install-forum.sh still writes $boardurl = 'http://localhost:8080', so every link and stylesheet on the new forum points at the other stack. SMF_RUNNER=docker in .env has no effect either.

lib.sh now reads .env when there is one, as KEY=VALUE lines rather than sourcing it. Comments, blank lines and invalid keys are skipped, surrounding quotes are dropped, and Windows line endings are tolerated. As with docker compose, anything already set in the environment wins, so WEB_PORT=9999 .dev/test.sh still means 9999.

Testing

There is no test harness for the shell scripts, so this was checked by hand:

  • with WEB_PORT=8480 in .env, sourcing lib.sh gives WEB_PORT=8480 and SMF_BOARDURL=http://localhost:8480 (before: 8080);
  • an exported WEB_PORT=9999 still wins;
  • a test .env with a quoted value, a CRLF line, a value containing =, an invalid key, a comment and no final newline reads as expected, and no helper variables are left behind;
  • .dev/test.sh --engine mysql --testsuite http --filter GuestPagesTest passes through the changed script.

Issues References (Fixes|Related|Closes)

None filed; found setting up a second stack for #9712.

🤖 Generated with Claude Code

compose.yaml takes its ports and credentials from .env, and lib.sh says
SMF_RUNNER can be set there too, but the scripts never read the file. A
stack moved to other ports was installed with a board URL on the default
one, so every link on the forum led to a different stack, and SMF_RUNNER in
.env did nothing.

lib.sh now reads .env as KEY=VALUE lines, without running it, and leaves
alone anything already in the environment, which is what docker compose
does too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: albertlast <mathiaspapealbert@hotmail.com>
@live627
live627 merged commit 9380f6f into SimpleMachines:release-3.0 Oct 2, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants