MCPcopy
hub / github.com/caddyserver/caddy / Provision

Method Provision

modules/caddytls/leafstorageloader.go:57–82  ·  view source on GitHub ↗

Provision loads the storage module for sl.

(ctx caddy.Context)

Source from the content-addressed store, hash-verified

55
56// Provision loads the storage module for sl.
57func (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.
85func (sl LeafStorageLoader) LoadLeafCertificates() ([]*x509.Certificate, error) {

Callers

nothing calls this directly

Calls 5

LoadModuleMethod · 0.80
StorageMethod · 0.80
ReplaceKnownMethod · 0.80
CertMagicStorageMethod · 0.65
ValueMethod · 0.45

Tested by

no test coverage detected