Skip to content

Apply One Naming Convention to Every Env and Secret File, Host-Side Files Included #3503

Closed

Description

@ptr727

Summary

Env and secret file names follow no single pattern across the fleet today, mixing underscores, dots, and dashes. The maintainer decided that every env and secret file a fleet repository names follows one convention, wherever the file lives. That includes a tracked template, a host-side file the repository's docs or scripts name (an ENV_FILE path, a compose env_file), and a secret file mounted into a container.

CODESTYLE.md "Script and Utility File Names" says only "Env and secret files | lowercase snake_case stem". It says nothing about host-side files or a multi-field stem. ptr727/Blog's resync for its issue 540 surfaced the gap, because Blog's host-side env files use a dotted multi-field stem.

The Rule

  • Scope. Every env and secret file a repository names, tracked or not.
  • Fields are joined by _, and each field keeps its own valid form. A host name field stays verbatim, hyphens included: <project>_web-01_prod.env, never <project>_web_01_prod.env or <project>.web-01.prod.env.
  • The separator is unambiguous. A DNS host name can carry - and never _, so every _ in the stem is a separator, and the name splits back into its fields.
  • Lowercase. No dot except the extension. Start and end with a letter or digit. A secret with no extension takes the same form, as db_root_password does now.
  • Variable names convert separately. Where a field becomes an env variable or CI secret name, which allow only A-Z, 0-9, and _, the hyphen becomes _ there, as in PROJECT_WEB_01_PROD_TOKEN, and never in the file name. The UPPER_SNAKE_CASE row for variable names is unchanged.
  • Limits that come from consumers. A name used as a Docker secret stays within 64 characters. A name that maps to a variable or CI secret does not start with a digit.
  • Tool-fixed names are exempt. .env, .env.local, and .env.production stay under the existing "externally fixed names" bullet.
  • Script file names are unchanged. Python stays snake_case, and shell, PowerShell, and batch stay hyphenated.

The research behind each limit, with its source per consumer, is in this comment.

Plan

  1. Hub rule, one pull request. Write the rule above into CODESTYLE.md "Script and Utility File Names", the row and a bullet under the table.
  2. A check where one is mechanical. Tracked env and secret file names are a path check in the hub's gate tooling. A host-side name is checkable only where a repository's docs or scripts spell it out, so the audit reads those references rather than the hosts.
  3. Audit and per-repository resync. AUDIT.md gains the item. Each repository's resync renames its tracked files and updates the docs and scripts that name the others. Renaming a file on a maintainer host is the maintainer's step, listed in that repository's resync pull request rather than performed by an agent.

Done When

CODESTYLE.md states the rule, the gate checks tracked names, and AUDIT.md carries the item. Each fleet repository's own rename is tracked in its resync rather than here.

🤖 Generated with Claude Code

Activity

  1. added
    decisionA question waiting on the maintainer, alone or beside whatever else the issue carries
    on Oct 26, 2026
  2. ptr727 commented on Oct 26, 2026

    @ptr727
    OwnerAuthor

    Decision

    The maintainer answered at the round-60 close of #2361. Env and secret file names follow no single pattern today, mixing underscores, dots, and dashes. The maintainer wants one consistent convention for every file and env name in every fleet repository, and left the rollout design to the implementing session.

    Read as it applies here, the row reaches every env and secret file a repository names, wherever the file lives. That covers a tracked template, a host-side file the repository's docs or scripts name (an ENV_FILE path, a compose env_file), and a CI secret's file form. Neither option above matches exactly. The answer is option 2's scope with a single stem form.

    Plan

    1. Hub rule (one PR, CODESTYLE.md "Script and Utility File Names"). The env and secret row states its scope: tracked or not, a file a repository names is covered. The whole stem before the extension is lowercase snake_case, so fields join with _. For example, <project>_<server>_<environment>.env, with a hyphen or a dot inside a field value, such as a hostname, also written as _. A file with no extension keeps the same stem form, as db_root_password does now. The env variable row (UPPER_SNAKE_CASE) is unchanged.
    2. A check where one is mechanical. Tracked env and secret file names are a path check, so add one to the hub's gate tooling. A host-side name is checkable only where a repository's docs or scripts spell it out, so the audit reads those references rather than the hosts.
    3. Audit and per-repository resync. AUDIT.md gains the item, and each repository's resync renames its tracked files and updates the docs and scripts that name the others. Renaming the files on a maintainer host is the maintainer's step, listed in each repository's resync pull request rather than performed by an agent.

    Script file names keep their per-language rules, PEP 8 snake_case for Python and hyphenated for shell, PowerShell, and batch, since those are deliberate and the table already gives each type one rule. If "all file names" was meant to override that split too, say so here before step 1 starts.

    The decision label is removed, and this issue stays open as the work.

  3. removed
    decisionA question waiting on the maintainer, alone or beside whatever else the issue carries
    on Oct 26, 2026
  4. ptr727 commented on Oct 26, 2026

    @ptr727
    OwnerAuthor

    Correction and research, agreed with the maintainer

    Correction to plan step 1 above. The plan said a hyphen or a dot inside a field value is also written as _. That is withdrawn. The maintainer has removed underscores from DNS names, since a host name may carry - and never _, and agreed the rule below:

    • _ separates fields, and each field keeps its own valid form. A host name field stays verbatim, hyphens included: <project>_web-01_prod.env, never <project>_web_01_prod.env.
    • Why the separator is unambiguous: a DNS host name can never contain _, so an _ in the stem is always a separator, and the name splits back into its fields.
    • Lowercase. No dot except the extension. Start and end with a letter or digit.
    • Converting to a variable name is a separate step. Where a field must become an env variable or CI secret name, which allow only A-Z, 0-9, and _, the hyphen becomes _ there, as in PROJECT_WEB_01_PROD_TOKEN, and never in the file name.

    Research: what each consumer accepts

    Consumer Rule Source
    Env variable names Uppercase letters, digits, and _, not starting with a digit POSIX.1-2024 ch. 8
    Docker / Swarm secret and config names ^[a-zA-Z0-9]+(?:[a-zA-Z0-9-_.]*[a-zA-Z0-9])?$, at most 64 characters swarmkit controlapi/common.go
    Compose secrets No stated rule. Docker's examples use db_password.txt and db_root_password, mounted at /run/secrets/<name> Docker docs
    Compose env_file / --env-file Any path and name Docker docs
    GitHub Actions secrets Alphanumerics and _ only. No leading digit, and no GITHUB_ prefix GitHub docs
    systemd LoadCredential= "a short ASCII string suitable as filename" systemd credentials
    Kubernetes Secret data keys, which become mounted file names Alphanumerics, -, _, or .. A Secret object's own name is a DNS subdomain and cannot carry _ Kubernetes docs
    run-parts, /etc/cron.d Letters, digits, _, and - only. A dotted name is silently skipped run-parts(8), cron(8)

    <project>_web-01_prod.env passes every row. The edge rules each come from a row: start and end alphanumeric and stay within 64 characters (Docker), and no leading digit where a name maps to a variable or CI secret (POSIX, GitHub). Tool-fixed names such as .env, .env.local, and .env.production stay under the existing "externally fixed names" exemption.

  5. changed the title [-]Say Whether the Env and Secret File Naming Row Reaches Host-Side Files[/-] [+]Apply One Naming Convention to Every Env and Secret File, Host-Side Files Included[/+] on Oct 26, 2026
  6. ptr727 commented on Oct 26, 2026

    @ptr727
    OwnerAuthor

    Host field answer

    The maintainer answered while #3506 was open. A local review asked how a fully qualified host name is written in a field, since "each field keeps its own valid form" and "no dot but the extension" disagreed for one.

    A host field is a short name, either the host's first DNS label (web-01) or a logical role name (vps-staging), and never the fully qualified name. The domain distinguishes nothing across the fleet. A dotted name is skipped by run-parts and cron.d, it makes the extension ambiguous, and it uses up Docker's 64-character secret limit. #3506 writes this into CODESTYLE.md, and the check already rejects the dots.

  7. added a commit that references this issue on Oct 26, 2026
    5dc8a50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions