Skip to content
This repository was archived by the owner on Jun 23, 2025. It is now read-only.

Conversation

Pew-X
Copy link

@Pew-X Pew-X commented Apr 20, 2025

This commit refactors the default user creation logic in server/main.go to improve clarity and robustness.

Previously, the default user was only added if a password was provided in the configuration. This change ensures the default user (specified by config.Config.Username) is always added to the auth.UserStore at startup. The user's password is now set conditionally .

This addresses the TODO comment about handling user addition better, and I attempted to decouple the user's existence from its password configuration.

Testing:
The relevant tests for the underlying authentication functions (TestUsersAddAndGet, TestUserSetPassword, TestNewSession) in internal/auth/session_test.go were run and passed successfully.

Important Note: The test file internal/auth/session_test.go had pre-existing compile errors unrelated to this change. Parts of the file had to be temporarily commented out to execute the relevant tests. Please do correct me if I am wrong.

@CLAassistant
Copy link

CLAassistant commented Apr 20, 2025

CLA assistant check
All committers have signed the CLA.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants