Skip to content

Commit

Permalink
feat: prepare using any other acme service
Browse files Browse the repository at this point in the history
  • Loading branch information
fritterhoff committed Dec 16, 2024
1 parent b917aca commit 34a88b7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
9 changes: 5 additions & 4 deletions backend/pki-service/cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ var runCmd = &cobra.Command{
}

// load Sectigo config
var sectigoCfg cfg.PKIConfiguration
if err := viper.Unmarshal(&sectigoCfg); err != nil {
var pkiCfg cfg.PKIConfiguration
if err := viper.Unmarshal(&pkiCfg); err != nil {
logger.Panic("config unmarshal failed", zap.Error(err))
}

Expand All @@ -46,7 +46,7 @@ var runCmd = &cobra.Command{

stopCh := signals.SetupSignalHandler()

sectigoCfg.CheckSectigoConfiguration()
pkiCfg.CheckSectigoConfiguration()

database.ConnectDb(logger, viper.GetString("db"))

Expand Down Expand Up @@ -86,7 +86,7 @@ var runCmd = &cobra.Command{
s.StartAsync()
// start gRPC server
if grpcCfg.Port > 0 {
grpcSrv, _ := grpc.NewServer(&grpcCfg, logger, &sectigoCfg, database.DB.Db)
grpcSrv, _ := grpc.NewServer(&grpcCfg, logger, &pkiCfg, database.DB.Db)
grpcSrv.ListenAndServe(stopCh)
}
},
Expand Down Expand Up @@ -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")
}
Original file line number Diff line number Diff line change
Expand Up @@ -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"`

Check failure on line 32 in backend/pki-service/pkg/cfg/pki.go

View workflow job for this annotation

GitHub Actions / lint (backend/pki-service)

var-naming: struct field DnsConfigs should be DNSConfigs (revive)
}

Expand Down
2 changes: 1 addition & 1 deletion backend/pki-service/pkg/grpc/ssl.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 34a88b7

Please sign in to comment.