[PR #4706] feat: env vars to auto-create user during initial setup #4318

Open
opened 2026-04-25 00:19:16 +02:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/advplyr/audiobookshelf/pull/4706
Author: @alex-sviridov
Created: 9/29/2025
Status: 🔄 Open

Base: masterHead: feature/autocreate_init_user


📝 Commits (1)

  • 0a49d13 feature: env vars to auto-create root user during initial setup

📊 Changes

3 files changed (+33 additions, -1 deletions)

View changed files

📝 .devcontainer/dev.js (+4 -1)
📝 index.js (+2 -0)
📝 server/Server.js (+27 -0)

📄 Description

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


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/advplyr/audiobookshelf/pull/4706 **Author:** [@alex-sviridov](https://github.com/alex-sviridov) **Created:** 9/29/2025 **Status:** 🔄 Open **Base:** `master` ← **Head:** `feature/autocreate_init_user` --- ### 📝 Commits (1) - [`0a49d13`](https://github.com/advplyr/audiobookshelf/commit/0a49d13c675590b68925f20068f6428bfb3d1543) feature: env vars to auto-create root user during initial setup ### 📊 Changes **3 files changed** (+33 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `.devcontainer/dev.js` (+4 -1) 📝 `index.js` (+2 -0) 📝 `server/Server.js` (+27 -0) </details> ### 📄 Description ## 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 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2026-04-25 00:19:16 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf#4318