Documentation
¶
Index ¶
- Constants
- func WatchFile(path string, stop <-chan struct{}, onChange func()) error
- type Admin
- type CA
- type Cache
- type Config
- func (c *Config) AdminAddr() string
- func (c *Config) AdminEnabled() bool
- func (c *Config) AdminHost() string
- func (c *Config) AdminPassword() string
- func (c *Config) AdminPort() int
- func (c *Config) AdminUsername() string
- func (c *Config) Algorithm() (crypto.Algorithm, error)
- func (c *Config) CADir() string
- func (c *Config) CacheEnabled() bool
- func (c *Config) CachePassword() string
- func (c *Config) EncryptEnabled() bool
- func (c *Config) GRPCAddr() string
- func (c *Config) GRPCEnabled() bool
- func (c *Config) GRPCPort() int
- func (c *Config) GRPCTLSAddr() string
- func (c *Config) GRPCTLSEnabled() bool
- func (c *Config) GRPCTLSPort() int
- func (c *Config) HTTPAddr() string
- func (c *Config) HTTPEnabled() bool
- func (c *Config) HTTPHost() string
- func (c *Config) HTTPPort() int
- func (c *Config) HTTPSAddr() string
- func (c *Config) HTTPSEnabled() bool
- func (c *Config) HTTPSPort() int
- func (c *Config) KeyBytes() []byte
- func (c *Config) LogDebug() bool
- func (c *Config) LogFile() string
- func (c *Config) LogLevel() string
- func (c *Config) PolicyPath() string
- func (c *Config) PrevKeyBytes() []byte
- type GRPCEndpoint
- type GRPCTLSEndpoint
- type HTTPEndpoint
- type HTTPSEndpoint
- type Log
- type Origin
- type Policy
- type Server
Constants ¶
const ( EnvConfig = "RBAC_CONFIG" EnvPolicyKey = "RBAC_POLICY_KEY" EnvPolicyKeyPrev = "RBAC_POLICY_KEY_PREV" EnvCachePassword = "RBAC_CACHE_PASSWORD" DefaultFileName = "config.yaml" DefaultHTTPPort = 8080 DefaultHTTPSPort = 8443 DefaultGRPCPort = 9080 DefaultGRPCTLSPort = 9443 DefaultHTTPHost = "0.0.0.0" DefaultAdminUser = "admin" DefaultAdminPassword = "admin" DefaultAdminHost = "127.0.0.1" DefaultAdminPort = 9090 DefaultLogLevel = "info" DefaultLogFile = "logs/rbac.log" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Admin ¶
type Config ¶
type Config struct {
// Path is the resolved config file (absolute when possible).
Path string `mapstructure:"-"`
// Origin is env, flag, or default.
Origin Origin `mapstructure:"-"`
Log Log `mapstructure:"log"`
Policy Policy `mapstructure:"policy"`
CA CA `mapstructure:"ca"`
Cache Cache `mapstructure:"cache"`
Server Server `mapstructure:"server"`
Admin Admin `mapstructure:"admin"`
// contains filtered or unexported fields
}
func Load ¶
Load reads YAML via viper, then ensures policy.crypto and policy.key exist. Missing default file uses built-in defaults; RBAC_CONFIG / --config must exist.
func (*Config) AdminEnabled ¶
func (*Config) AdminPassword ¶
func (*Config) AdminUsername ¶
func (*Config) CacheEnabled ¶
func (*Config) CachePassword ¶
func (*Config) EncryptEnabled ¶
func (*Config) GRPCEnabled ¶ added in v0.1.1
func (*Config) GRPCTLSAddr ¶ added in v0.1.1
func (*Config) GRPCTLSEnabled ¶ added in v0.1.1
func (*Config) GRPCTLSPort ¶ added in v0.1.1
func (*Config) HTTPEnabled ¶
func (*Config) HTTPSEnabled ¶
func (*Config) PolicyPath ¶
func (*Config) PrevKeyBytes ¶
type GRPCEndpoint ¶ added in v0.1.1
GRPCEndpoint is plaintext gRPC (h2c). Host defaults to server.http.host.
type GRPCTLSEndpoint ¶ added in v0.1.1
GRPCTLSEndpoint is gRPC over TLS, reusing the HTTPS server certificate.
type HTTPEndpoint ¶
type HTTPSEndpoint ¶
type Log ¶
type Log struct {
Level string `mapstructure:"level"`
File string `mapstructure:"file"`
Debug bool `mapstructure:"debug"`
}
Log controls structured logging output.
type Origin ¶
type Origin string
Origin is how the config file path was chosen. Precedence: RBAC_CONFIG > --config > <cwd>/config.yaml.
func ResolvePath ¶
type Server ¶
type Server struct {
HTTP HTTPEndpoint `mapstructure:"http"`
HTTPS HTTPSEndpoint `mapstructure:"https"`
GRPC GRPCEndpoint `mapstructure:"grpc"`
GRPCTLS GRPCTLSEndpoint `mapstructure:"grpc_tls"`
}