Add ability to read Admin key from env var path

This commit is contained in:
Alex Westerman 2026-05-29 16:56:57 -04:00 committed by GitHub
parent ee420fbf29
commit 74ccfbbddb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -86,6 +86,15 @@ func (g *garage) GetS3Region() string {
} }
func (g *garage) GetAdminKey() string { func (g *garage) GetAdminKey() string {
keyPath := os.Getenv("API_ADMIN_KEY_FILE")
if len(keyPath) > 0 {
key, err := os.ReadFile(keyPath)
if err != nil {
log.Fatal(err)
}
return key
}
key := os.Getenv("API_ADMIN_KEY") key := os.Getenv("API_ADMIN_KEY")
if len(key) > 0 { if len(key) > 0 {
return key return key