mirror of
https://github.com/JustKato/drive-health.git
synced 2026-04-30 01:42:29 +03:00
Implemented Authentication
+ Basic Authentication
This commit is contained in:
@@ -13,6 +13,8 @@ type DHConfig struct {
|
||||
MaxHistoryAge int `json:"maxHistoryAge"`
|
||||
DatabaseFilePath string
|
||||
Listen string
|
||||
IdentityUsername string
|
||||
IdentityPassword string
|
||||
}
|
||||
|
||||
func GetConfiguration() DHConfig {
|
||||
@@ -25,6 +27,8 @@ func GetConfiguration() DHConfig {
|
||||
DiskFetchFrequency: 5, // default value
|
||||
MaxHistoryAge: 2592000, // default value
|
||||
DatabaseFilePath: "./data.sqlite",
|
||||
IdentityUsername: "admin",
|
||||
IdentityPassword: "admin",
|
||||
|
||||
Listen: ":8080",
|
||||
}
|
||||
@@ -49,5 +53,13 @@ func GetConfiguration() DHConfig {
|
||||
config.DatabaseFilePath = val
|
||||
}
|
||||
|
||||
if val, exists := os.LookupEnv("IDENTITY_USERNAME"); exists {
|
||||
config.IdentityUsername = val
|
||||
}
|
||||
|
||||
if val, exists := os.LookupEnv("IDENTITY_PASSWORD"); exists {
|
||||
config.IdentityPassword = val
|
||||
}
|
||||
|
||||
return config
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user