options.go 611 B

123456789101112131415161718192021222324
  1. package authority
  2. import (
  3. "github.com/smallstep/certificates/db"
  4. )
  5. // Option sets options to the Authority.
  6. type Option func(*Authority)
  7. // WithDatabase sets an already initialized authority database to a new
  8. // authority. This option is intended to be use on graceful reloads.
  9. func WithDatabase(db db.AuthDB) Option {
  10. return func(a *Authority) {
  11. a.db = db
  12. }
  13. }
  14. // WithSSHBastionFunc defines sets a custom function to get the bastion for a
  15. // given user-host pair.
  16. func WithSSHBastionFunc(fn func(user, host string) (*Bastion, error)) Option {
  17. return func(a *Authority) {
  18. a.sshBastionFunc = fn
  19. }
  20. }