DevAdminUsername/DevAdminPassword config fields are dead code #22

Closed
opened 2026-03-02 01:28:54 +01:00 by clawbot · 0 comments
Collaborator

Bug

internal/config/config.go reads DEV_ADMIN_USERNAME and DEV_ADMIN_PASSWORD from environment variables:

DevAdminUsername: envString("DEV_ADMIN_USERNAME", "devAdminUsername"),
DevAdminPassword: envString("DEV_ADMIN_PASSWORD", "devAdminPassword"),

But these values are never used anywhere in the codebase. The admin user is always created with a randomly generated password in database.go:

password, err := GenerateRandomPassword(16)

No code ever reads Config.DevAdminUsername or Config.DevAdminPassword.

Fix

Either:

  1. Remove the dead config fields, or
  2. Actually use them in database.go to set a deterministic admin password in dev mode (which would improve DX)

Option 2 example:

if d.params.Config.IsDev() && d.params.Config.DevAdminPassword != "" {
    password = d.params.Config.DevAdminPassword
} else {
    password, err = GenerateRandomPassword(16)
}

Category

Should-fix. Dead code adds confusion.

## Bug `internal/config/config.go` reads `DEV_ADMIN_USERNAME` and `DEV_ADMIN_PASSWORD` from environment variables: ```go DevAdminUsername: envString("DEV_ADMIN_USERNAME", "devAdminUsername"), DevAdminPassword: envString("DEV_ADMIN_PASSWORD", "devAdminPassword"), ``` But these values are never used anywhere in the codebase. The admin user is always created with a randomly generated password in `database.go`: ```go password, err := GenerateRandomPassword(16) ``` No code ever reads `Config.DevAdminUsername` or `Config.DevAdminPassword`. ## Fix Either: 1. Remove the dead config fields, or 2. Actually use them in `database.go` to set a deterministic admin password in dev mode (which would improve DX) Option 2 example: ```go if d.params.Config.IsDev() && d.params.Config.DevAdminPassword != "" { password = d.params.Config.DevAdminPassword } else { password, err = GenerateRandomPassword(16) } ``` ## Category Should-fix. Dead code adds confusion.
clawbot added the
bot
label 2026-03-02 01:28:54 +01:00
sneak closed this issue 2026-03-04 01:19:43 +01:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: sneak/webhooker#22
No description provided.