Skip to content

Conversation

@alex-sviridov
Copy link

Brief summary

Two new environment variables can be set: INIT_USER_NAME and INIT_USER_PASSWORD.
If specified, Audiobookshelf automatically creates a superuser with the provided username and password at initial run, not asking user to provide this information via web-interface.

Which issue is fixed?

Fixes #4704

In-depth Description

Two new environment variables can be set: INIT_USER_NAME and INIT_USER_PASSWORD. If INIT_USER_NAME is set and INIT_USER_PASSWORD is not, then a user with empty password is created. If any user already exists, no changes are done.
This allows us to provide root user data in environment variable (which is useful for container deployment) or via dev.js variables InitUserName and InitUserPassword.

How have you tested this?

Running the container like that: docker run -p 8080:80 -e INIT_USER_NAME=admin -e INIT_USER_PASSWORD=1234 ecf6aabecf96

We can see log messages:

[2025-09-29 14:19:40.812] INFO: [Server] Auto-creating root user "admin" from environment variables [2025-09-29 14:19:40.851] INFO: [Server] Successfully auto-created root user "admin"

During the login these credentials can be used, no "initial login" page is shown.

Screenshots

N/A

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Enhancement]: Allow root user auto-creation via environment variables

1 participant