mirror of
https://github.com/steveiliop56/tinyauth.git
synced 2025-12-21 15:42:36 +00:00
fix: handle type string for oauth groups
This commit is contained in:
@@ -327,3 +327,15 @@ func DeriveKey(secret string, info string) (string, error) {
|
||||
encodedKey := base64.StdEncoding.EncodeToString(key)
|
||||
return encodedKey, nil
|
||||
}
|
||||
|
||||
func CoalesceToString(value any) string {
|
||||
switch v := value.(type) {
|
||||
case []string:
|
||||
return strings.Join(v, ",")
|
||||
case string:
|
||||
return v
|
||||
default:
|
||||
log.Warn().Interface("value", value).Msg("Unsupported type, returning empty string")
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user