23 lines
501 B
Go
23 lines
501 B
Go
// Package rbac provides Role-Based Access Control functionality
|
|
package rbac
|
|
|
|
import (
|
|
"errors"
|
|
|
|
"git.haelnorr.com/h/golib/env"
|
|
)
|
|
|
|
type Config struct {
|
|
AdminDiscordID string `ezconf:"ADMIN_DISCORD_ID,required,description:Discord ID to grant admin role on first login"`
|
|
}
|
|
|
|
func ConfigFromEnv() (any, error) {
|
|
cfg := &Config{
|
|
AdminDiscordID: env.String("ADMIN_DISCORD_ID", ""),
|
|
}
|
|
if cfg.AdminDiscordID == "" {
|
|
return nil, errors.New("env var not set: ADMIN_DISCORD_ID")
|
|
}
|
|
return cfg, nil
|
|
}
|