From 8c709fe3c2a4d3fd8cd08f35491d75eb17d898d4 Mon Sep 17 00:00:00 2001 From: max furman Date: Tue, 4 May 2021 14:45:11 -0700 Subject: [PATCH] Init config on load | Add wrapper for cli --- authority/config.go | 2 ++ ca/identity/identity.go | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/authority/config.go b/authority/config.go index 86a5c80c..b02bc2be 100644 --- a/authority/config.go +++ b/authority/config.go @@ -146,6 +146,8 @@ func LoadConfiguration(filename string) (*Config, error) { return nil, errors.Wrapf(err, "error parsing %s", filename) } + c.init() + return &c, nil } diff --git a/ca/identity/identity.go b/ca/identity/identity.go index 08a70c7f..0f022dd7 100644 --- a/ca/identity/identity.go +++ b/ca/identity/identity.go @@ -134,6 +134,12 @@ func WriteDefaultIdentity(certChain []api.Certificate, key crypto.PrivateKey) er return nil } +// WriteIdentityCertificate writes the identity certificate to disk. +func WriteIdentityCertificate(certChain []api.Certificate) error { + filename := filepath.Join(identityDir, "identity.crt") + return writeCertificate(filename, certChain) +} + // writeCertificate writes the given certificate on disk. func writeCertificate(filename string, certChain []api.Certificate) error { buf := new(bytes.Buffer)