Config templates don't have access to STACK_NAME unless it's used as an env var in the compose file #725

Closed
opened 2025-11-07 22:26:17 +00:00 by pharaohgraphy · 2 comments
Member

See the relevant docs PR to keep track of this till it's resolved: toolshed/docs.coopcloud.tech#291

This came out of a rabbit hole deep dive where @3wordchant theorized it's very likely that STACK_NAME isn't available for use early enough in .tmpl files via Docker configs.

Unless, we add it as an environment variable to any of the Docker compose services, then it's available (that's what the docs mention as a workaround for now)

Ideally, Abra should handle this anyway & ensure that STACK_NAME is initialized early enough for config templates to work 🙏

*See the relevant docs PR to keep track of this till it's resolved: https://git.coopcloud.tech/toolshed/docs.coopcloud.tech/pulls/291* This came out of a rabbit hole deep dive where @3wordchant theorized it's very likely that `STACK_NAME` [isn't available for use early enough](https://git.coopcloud.tech/toolshed/abra/src/branch/main/pkg/app/app.go#L122) in `.tmpl` files via Docker configs. Unless, we **add it as an environment variable** to any of the Docker compose services, then it's available (that's what the docs mention as a workaround for now) Ideally, Abra should handle this anyway & ensure that `STACK_NAME` is initialized early enough for config templates to work 🙏
decentral1se added the
enhancement
label 2025-11-09 08:00:55 +00:00
Owner

@pharaohgraphy ah, my apologies, I understand the issue now better. Thanks for raising.

There is nothing much we can do this about, I believe. In order to have docker bring env vars into the template files, you must specify them in the env: ... stanza (like everything else). I don't believe these can be inserted at runtime "under the hood" because we don't have access to the template engine step.

I agree this is a bit of a footgun. I'll work on the docs patch now. I think we can have a section on "special env vars".

@pharaohgraphy ah, my apologies, I understand the issue now better. Thanks for raising. There is nothing much we can do this about, I believe. In order to have docker bring env vars into the template files, you *must* specify them in the `env: ...` stanza (like everything else). I don't believe these can be inserted at runtime "under the hood" because we don't have access to the template engine step. I agree this is a bit of a footgun. I'll work on the docs patch now. I think we can have a section on "special env vars".
Owner
https://git.coopcloud.tech/toolshed/docs.coopcloud.tech/commit/f0120151d882c0e3f8430b480335de72d4554283
Sign in to join this conversation.
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: toolshed/abra#725
No description provided.