mirror of
https://github.com/psviderski/uncloud.git
synced 2026-08-26 19:13:34 +00:00
feat: enable auth for local requests to Corrosion API (resolves #110)
This commit is contained in:
@@ -37,7 +37,12 @@ type GossipConfig struct {
|
||||
}
|
||||
|
||||
type APIConfig struct {
|
||||
Addr netip.AddrPort `toml:"addr"`
|
||||
Addr netip.AddrPort `toml:"addr"`
|
||||
Authz APIAuthzConfig `toml:"authz"`
|
||||
}
|
||||
|
||||
type APIAuthzConfig struct {
|
||||
BearerToken string `toml:"bearer-token"`
|
||||
}
|
||||
|
||||
type AdminConfig struct {
|
||||
|
||||
@@ -35,7 +35,7 @@ func WaitReady(ctx context.Context, dataDir string) error {
|
||||
return fmt.Errorf("unmarshal config: %w", err)
|
||||
}
|
||||
|
||||
corro, err := corrosion.NewAPIClient(config.API.Addr)
|
||||
corro, err := corrosion.NewAPIClient(config.API.Addr, config.API.Authz.BearerToken)
|
||||
if err != nil {
|
||||
return fmt.Errorf("create corrosion API client: %w", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user