Provision loads the storage module for sl.
(ctx caddy.Context)
| 55 | |
| 56 | // Provision loads the storage module for sl. |
| 57 | func (sl *LeafStorageLoader) Provision(ctx caddy.Context) error { |
| 58 | if sl.StorageRaw != nil { |
| 59 | val, err := ctx.LoadModule(sl, "StorageRaw") |
| 60 | if err != nil { |
| 61 | return fmt.Errorf("loading storage module: %v", err) |
| 62 | } |
| 63 | cmStorage, err := val.(caddy.StorageConverter).CertMagicStorage() |
| 64 | if err != nil { |
| 65 | return fmt.Errorf("creating storage configuration: %v", err) |
| 66 | } |
| 67 | sl.storage = cmStorage |
| 68 | } |
| 69 | if sl.storage == nil { |
| 70 | sl.storage = ctx.Storage() |
| 71 | } |
| 72 | sl.ctx = ctx |
| 73 | |
| 74 | repl, ok := ctx.Value(caddy.ReplacerCtxKey).(*caddy.Replacer) |
| 75 | if !ok { |
| 76 | repl = caddy.NewReplacer() |
| 77 | } |
| 78 | for k, path := range sl.Certificates { |
| 79 | sl.Certificates[k] = repl.ReplaceKnown(path, "") |
| 80 | } |
| 81 | return nil |
| 82 | } |
| 83 | |
| 84 | // LoadLeafCertificates returns the certificates to be loaded by sl. |
| 85 | func (sl LeafStorageLoader) LoadLeafCertificates() ([]*x509.Certificate, error) { |
nothing calls this directly
no test coverage detected