feat(keys): allow to set api keys to secure the instance (#39)
This commit is contained in:
committed by
GitHub
parent
1e484d7ccd
commit
0ad2de72e0
@@ -5,6 +5,7 @@ import "github.com/mudler/LocalAgent/core/state"
|
||||
type Config struct {
|
||||
DefaultChunkSize int
|
||||
Pool *state.AgentPool
|
||||
ApiKeys []string
|
||||
}
|
||||
|
||||
type Option func(*Config)
|
||||
@@ -21,6 +22,12 @@ func WithPool(pool *state.AgentPool) Option {
|
||||
}
|
||||
}
|
||||
|
||||
func WithApiKeys(keys ...string) Option {
|
||||
return func(c *Config) {
|
||||
c.ApiKeys = keys
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Config) Apply(opts ...Option) {
|
||||
for _, opt := range opts {
|
||||
opt(c)
|
||||
|
||||
Reference in New Issue
Block a user