Remove the current secret management with dodotenv. Instead put the secrets directly…
- User
Remove the current secret management with dodotenv. Instead put the secrets directly into the config where they are used. Still allow to set secrets using environment variables. Env variables take precendence. Update all related parts.
Assistant· claude-opus-4-8
I'll explore the codebase to understand the current secret management with godotenv and how secrets are used.
Assistant· claude-opus-4-8
Let me read the key files directly to design an accurate plan.
Assistant· claude-opus-4-8
Now let me read the LDAP, OIDC, auth.go orchestration, schema, and the main.go/init.go startup sections.
Assistant· claude-opus-4-8
Now let me read the auth schema, the config schema, init.go, and the relevant main.go sections.
Assistant· claude-opus-4-8
Let me check documentation and other references to
.env, godotenv, and the env vars across the repo.Assistant· claude-opus-4-8
I have enough understanding. Let me quickly check the example config files' auth sections.
Assistant· claude-opus-4-8
I now have a complete picture. Let me write the plan.
Assistant· claude-opus-4-8
The plan is ready. Let me present it for approval.
Assistant· claude-opus-4-8
Let me set up task tracking and start implementing.
Assistant· claude-opus-4-8
Starting with task 1 — adding fields and the helper. First the
secretFromEnvhelper in auth.go (needosimport):Assistant· claude-opus-4-8
Now add fields to the config structs:
Assistant· claude-opus-4-8
The unused warning will clear once I wire it in. Now LdapConfig and OpenIDConfig:
Assistant· claude-opus-4-8
Now the JSON schema. Add the new optional string properties:
Assistant· claude-opus-4-8
Task 1 done. Now task 2 — wire
secretFromEnvinto the authenticators.Assistant· claude-opus-4-8
jwt.go — replace os.Getenv and drop the now-unused
osimport:Assistant· claude-opus-4-8
Now jwtCookieSession.go:
Assistant· claude-opus-4-8
Now drop the
osimport from jwtCookieSession.go:Assistant· claude-opus-4-8
Now jwtSession.go:
Assistant· claude-opus-4-8
Now ldap.go:
Assistant· claude-opus-4-8
Check whether
osis still used in ldap.go:Assistant· claude-opus-4-8
Now oidc.go:
Assistant· claude-opus-4-8
Task 2 done. Now task 3 — main.go and init.go.
Assistant· claude-opus-4-8
Let me check the main.go imports for godotenv:
Assistant· claude-opus-4-8
Now remove the call and update the comment block:
Assistant· claude-opus-4-8
Now
checkDefaultSecurityKeys()and the post-init message:Assistant· claude-opus-4-8
Now init.go — remove envString and .env writing, move keys into configString:
Assistant· claude-opus-4-8
The
_commentfield would breakDisallowUnknownFields()decoding. Let me remove it:Assistant· claude-opus-4-8
Now remove the
.envwriting block in init.go:Assistant· claude-opus-4-8
Now cli.go help text:
Assistant· claude-opus-4-8
Let me build to verify the Go code compiles so far:
Assistant· claude-opus-4-8
Builds clean. Task 3 done. Now task 4 — configs, docs, tools, go mod tidy.
Assistant· claude-opus-4-8
Let me delete the env-template, run go mod tidy, and read the config/doc files to update in parallel:
Assistant· claude-opus-4-8
godotenv is gone. Now update the example configs:
Assistant· claude-opus-4-8
That diagnostic is stale (already removed; build passed). Now config-demo.json:
Assistant· claude-opus-4-8
Let me check startDemo.sh since it sets up a demo with JWT keys:
Assistant· claude-opus-4-8
startDemo.sh is fine now. Now the docs. Let me read README.md and init/README.md sections:
Assistant· claude-opus-4-8
Now init/README.md:
Assistant· claude-opus-4-8
Now the tools/convert-pem-pubkey:
Assistant· claude-opus-4-8
Now the
.envwording in config.go and schema.go (drop-privileges descriptions):Assistant· claude-opus-4-8
Now CLAUDE.md — update the
.envconfiguration section:Assistant· claude-opus-4-8
Now let me build, run go vet, and the auth tests; plus verify no stray references remain:
Assistant· claude-opus-4-8
Clean. Now run the tests:
Assistant· claude-opus-4-8
Let me run the full Go test suite:
Assistant· claude-opus-4-8
All tests pass. Now let me verify the
-initflow end-to-end in a temp dir (confirms generated config parses and no.envis written):Assistant· claude-opus-4-8
Init verified. Now let me verify the server-side behavior: minting a JWT (proves private key loads from config) and env precedence on the default-key warning. Let me check the gen-jwt flag name:
Assistant· claude-opus-4-8
The precedence logic is verified. Let me confirm the JWT itself is actually minted (the earlier capture caught a log line). Let me grab the token cleanly:
Assistant· claude-opus-4-8
A valid EdDSA JWT is minted using the private key from
config.json. All verification steps pass. Let me mark task 4 complete and do a final review of the full diff.Assistant· claude-opus-4-8
- User
Commit the solution and add a remark in the commit that it closes issue 283
Assistant· claude-opus-4-8
Committed on
feature-283-remove-env-support-alt:83d04dff—feat(auth): replace .env/godotenv secret handling with config-based secrets- 22 files changed, 151 insertions(+), 95 deletions(-)
- Body includes
Closes #283
The commit is local; let me know if you'd like me to push it or open a PR.