Add a configuration to disable signing up

This commit is contained in:
2026-02-23 17:59:13 +01:00
parent eba6a279eb
commit 0702a2b0cb
3 changed files with 28 additions and 15 deletions

View File

@@ -11,24 +11,26 @@ import (
)
type Config struct {
Port string `toml:"port" default:"8080" comment:"The port to listen on for the server."`
DatabaseFilePath string `toml:"database-file-path" default:"plm.db" comment:"Path to sqlite database file."`
DemoDataPath string `toml:"demo-data-path" comment:"The path to the sql file to load for demo data."`
JWTKey string `toml:"jwt-key" comment:"The key used to encrypt the generated JWT. Encoded in base64. If empty a random one will be generated on every restart."`
ImageFolderPath string `toml:"image-folder-path" default:"img" comment:"Folder where uploaded files will be stored."`
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."`
Port string `toml:"port" default:"8080" comment:"The port to listen on for the server."`
DatabaseFilePath string `toml:"database-file-path" default:"plm.db" comment:"Path to sqlite database file."`
DemoDataPath string `toml:"demo-data-path" comment:"The path to the sql file to load for demo data."`
JWTKey string `toml:"jwt-key" comment:"The key used to encrypt the generated JWT. Encoded in base64. If empty a random one will be generated on every restart."`
ImageFolderPath string `toml:"image-folder-path" default:"img" comment:"Folder where uploaded files will be stored."`
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."`
}
func defaultConfig() Config {
return Config{
Port: "8080",
DatabaseFilePath: "plm.db",
DemoDataPath: "",
JWTKey: "",
ImageFolderPath: "img",
Limit: 100,
InventaireUrl: "https://inventaire.io",
Port: "8080",
DatabaseFilePath: "plm.db",
DemoDataPath: "",
JWTKey: "",
ImageFolderPath: "img",
Limit: 100,
InventaireUrl: "https://inventaire.io",
DisableRegistration: false,
}
}