diff --git a/backend/pki-service/cmd/run.go b/backend/pki-service/cmd/run.go index aa947dd2..e909a7b1 100644 --- a/backend/pki-service/cmd/run.go +++ b/backend/pki-service/cmd/run.go @@ -31,8 +31,8 @@ var runCmd = &cobra.Command{ } // load Sectigo config - var sectigoCfg cfg.PKIConfiguration - if err := viper.Unmarshal(§igoCfg); err != nil { + var pkiCfg cfg.PKIConfiguration + if err := viper.Unmarshal(&pkiCfg); err != nil { logger.Panic("config unmarshal failed", zap.Error(err)) } @@ -46,7 +46,7 @@ var runCmd = &cobra.Command{ stopCh := signals.SetupSignalHandler() - sectigoCfg.CheckSectigoConfiguration() + pkiCfg.CheckSectigoConfiguration() database.ConnectDb(logger, viper.GetString("db")) @@ -86,7 +86,7 @@ var runCmd = &cobra.Command{ s.StartAsync() // start gRPC server if grpcCfg.Port > 0 { - grpcSrv, _ := grpc.NewServer(&grpcCfg, logger, §igoCfg, database.DB.Db) + grpcSrv, _ := grpc.NewServer(&grpcCfg, logger, &pkiCfg, database.DB.Db) grpcSrv.ListenAndServe(stopCh) } }, @@ -123,5 +123,6 @@ func init() { runCmd.Flags().String("acme_email", "", "Email for the acme client") runCmd.Flags().String("acme_hmac", "", "EAB HMAC for the acme client") runCmd.Flags().String("acme_kid", "", "Key ID for the acme client") + runCmd.Flags().String("acme_server", "", "Server for the acme client") runCmd.Flags().String("dns_configs", "", "Config file for the dns provider") } diff --git a/backend/pki-service/pkg/cfg/sectigo.go b/backend/pki-service/pkg/cfg/pki.go similarity index 97% rename from backend/pki-service/pkg/cfg/sectigo.go rename to backend/pki-service/pkg/cfg/pki.go index ec4705cf..0dd660c6 100644 --- a/backend/pki-service/pkg/cfg/sectigo.go +++ b/backend/pki-service/pkg/cfg/pki.go @@ -28,6 +28,7 @@ type PKIConfiguration struct { AcmeEmail string `mapstructure:"acme_email"` AcmeKid string `mapstructure:"acme_kid"` AcmeHmac string `mapstructure:"acme_hmac"` + AcmeServer string `mapstructure:"acme_server"` DnsConfigs string `mapstructure:"dns_configs"` } diff --git a/backend/pki-service/pkg/grpc/ssl.go b/backend/pki-service/pkg/grpc/ssl.go index 69a759fa..1c8ec2ec 100644 --- a/backend/pki-service/pkg/grpc/ssl.go +++ b/backend/pki-service/pkg/grpc/ssl.go @@ -167,7 +167,7 @@ func registerAcme(cfg *cfg.PKIConfiguration) *lego.Client { } legoCfg := lego.NewConfig(&account) - + legoCfg.CADirURL = cfg.AcmeServer legoLog.Logger = pkiHelper.NewZapLogger(zap.L()) legoCfg.Certificate.Timeout = time.Duration(5) * time.Minute if account.Registration == nil {