temporalio / temporalio/temporal
Review/Improve Startup Config Template Rendering Code/Process using Sprig
@fretz12 is already working on this.
Since Jun 11, 2026.
- Dominant language
- Go
- Stars
- 23.2k
- Forks
- 1.9k
- Avg merge
- 2d 8h
- Merged PRs (30d)
- 228
Description
Is your feature request related to a problem? Please describe.
At startup, the config loader reads files from $TEMPORAL_ROOT/config/ (default: config/) in precedence order — base.yaml, {env}.yaml, {env}_{zone}.yaml — or a single file specified by TEMPORAL_SERVER_CONFIG_FILE_PATH. For each file, the loader scans the first 1KB for # enable-template (loader.go:51, loader.go:273) to decide whether to render it as a Go/Sprig template. This approach has several silent failure modes:
- A typo like
# enable-templatesor a comment like# do-not-enable-templatesilently mis-triggers or disables rendering. A file full of{{ env "VAR" }}with a missing or misspelled comment loads as literal YAML with no clear error. - A long header comment can push
# enable-templatepast the 1KB scan window, silently disabling templating. strings.Containsmatches any comment containing the substringenable-template, including unrelated comments like# to render this template using sprig add a comment as follows: # enable-template.
Describe the solution you'd like
Always render config files through the Go/Sprig template engine. Plain YAML passes through unchanged, so there is no downside. The change eliminates bugs and reduces code complexity:
| What is removed | Location | Lines Removed |
|---|---|---|
enableTemplate, commentSearchLimit constants |
loader.go:51–52 |
2 |
bufio, io imports |
loader.go:4–5 |
2 |
checkTemplatingEnabled call + guard in processConfigFile |
loader.go:228–237 |
10 |
checkTemplatingEnabled function (cyclomatic complexity: 3) |
loader.go:268–279 |
12 |
| Total | 26 |
I'd be happy to submit a pull request for this change if the approach is agreeable.
Describe alternatives you've considered
- Use a
.yaml.tmplextension to signal templated files — unambiguous and consistent with common convention. - Add an explicit
--config-templatedflag orTEMPORAL_CONFIG_TEMPLATE_RENDER_WITH_SPRIGenv var (defaulttrue).
Additional context
Relevant code in common/config/loader.go:
- Lines 51–52:
enableTemplate,commentSearchLimitconstants - Lines 227–252:
processConfigFile - Lines 268–279:
checkTemplatingEnabled
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.