2019-11-14 23:29:04 +00:00
|
|
|
package authority
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/smallstep/certificates/db"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Option sets options to the Authority.
|
|
|
|
type Option func(*Authority)
|
|
|
|
|
|
|
|
// WithDatabase sets an already initialized authority database to a new
|
|
|
|
// authority. This option is intended to be use on graceful reloads.
|
|
|
|
func WithDatabase(db db.AuthDB) Option {
|
|
|
|
return func(a *Authority) {
|
|
|
|
a.db = db
|
|
|
|
}
|
|
|
|
}
|
2019-11-15 02:24:58 +00:00
|
|
|
|
|
|
|
// WithSSHBastionFunc defines sets a custom function to get the bastion for a
|
|
|
|
// given user-host pair.
|
|
|
|
func WithSSHBastionFunc(fn func(user, host string) (*Bastion, error)) Option {
|
|
|
|
return func(a *Authority) {
|
|
|
|
a.sshBastionFunc = fn
|
|
|
|
}
|
|
|
|
}
|