Menu ▾ ▴

#26 [Feature]: Render configuration templates with environment secrets

open
nobody
2026-09-21
2026-09-11
Anonymous
No

Originally created by: thomijasir
Originally owned by: thomijasir

Feature description

Render a text template by replacing named placeholders with secrets from one Dopbase environment.

Current behavior

The CLI can inject secrets into a child environment or export an entire dotenv file. It cannot produce an application-specific configuration shape.

Why we need this

Some applications need a configuration file with fixed syntax. A renderer avoids custom scripts that fetch, escape, and combine plaintext values.

Proposed CLI interface

  • dopbase render ENVIRONMENT TEMPLATE
  • dopbase render ENVIRONMENT TEMPLATE --output config.yaml
  • dopbase render ENVIRONMENT TEMPLATE --output config.yaml --force
  • Placeholder syntax: {{SECRET_NAME}}

Expected behavior

  • Read the template from a file, or from stdin when the path is -.
  • Fetch runtime secrets using the same environment and credential rules as dopbase run.
  • Replace exact {{NAME}} placeholders without evaluating expressions, functions, includes, loops, or shell syntax.
  • Fail when a placeholder has no matching secret.
  • Write to stdout by default or to a private file with --output.
  • Refuse to overwrite an output file unless --force is present.
  • Preserve all non-placeholder text byte for byte.
  • Report missing names without printing other values.

Security and compatibility

  • Treat rendered output as plaintext secret material.
  • Create output files with private permissions.
  • Never evaluate shell commands or template expressions.
  • Do not include rendered content in logs, errors, or JSON diagnostics.
  • Reject templates whose output exceeds the existing secret collection size limit plus template text.

Out of scope

  • General-purpose template programming.
  • Multiple source environments.
  • Automatic reload or process restart.
  • Rendering directly into repository files without explicit output.

Acceptance criteria

  • [ ] Known placeholders render correctly from the selected environment.
  • [ ] Missing and malformed placeholders fail before creating or replacing an output file.
  • [ ] Stdin templates and stdout output work in pipelines.
  • [ ] Output files are private and protected by --force.
  • [ ] Literal text and repeated placeholders are preserved correctly.
  • [ ] Runner credentials can render only the environment they are scoped to.

Test scenarios

  • Add parser, renderer, and command tests under app/tests/cli/.
  • Cover repeated placeholders, adjacent placeholders, missing names, malformed delimiters, Unicode, stdin, overwrite behavior, permissions, output limits, runner scope, and value redaction.

Documentation

Document placeholder syntax, plaintext risks, stdin and stdout usage, file permissions, and examples for JSON, YAML, and service configuration files.

Dependencies

Uses the existing runtime secrets endpoint and credential scope rules. No server change is required.

Discussion

  • Anonymous

    Anonymous - 2026-09-11
     

Log in to post a comment.