Added an option to specify demo user, will be created on startup if it does not exist

This commit is contained in:
2026-03-02 15:28:00 +01:00
parent 660c44992e
commit 78c777170b
6 changed files with 17 additions and 7 deletions

View File

@@ -20,7 +20,8 @@ type Config struct {
Limit int `toml:"limit" default:"100" comment:"A single API call will return at most this number of records."`
InventaireUrl string `toml:"inventaire-url" default:"https://inventaire.io" comment:"An inventaire.io instance URL."`
DisableRegistration bool `toml:"disable-registration" default:"false" comment:"Disable new account creation."`
DemoMode bool `toml:"demo-mode" default:"false" comment:"Activate demo mode: anyone connecting to the instance will be logged in as user 'demo'"`
DemoMode bool `toml:"demo-mode" default:"false" comment:"Activate demo mode: anyone connecting to the instance will be logged in as a single user."`
DemoUsername string `toml:"demo-username" default:"demo" comment:"Name of the single user used for the demo."`
AddUser UserListAsStrings `toml:"add-user" short:"a" comment:"Add an user on startup following htpasswd bcrypt format, example: [\"demo:$2y$10$UHR2646SZo2W.Rhna7bn5eWNLXWJZ/Sa3oLd9RlxlXs57Bwp6isOS\",\"user:$2y$10$3WYUp.VDpzJRywtrxO1s/uWfUIKpTE4yh5B1d2RCef3hvczYbEWTC\"]"`
}
@@ -46,6 +47,7 @@ func defaultConfig() Config {
InventaireUrl: "https://inventaire.io",
DisableRegistration: false,
DemoMode: false,
DemoUsername: "demo",
AddUser: []string{},
}
}