@@ -67,7 +67,10 @@ import (
6767 "google.golang.org/grpc/keepalive"
6868)
6969
70- const serveCmdEnvPrefix = "FULCIO_SERVE"
70+ const (
71+ serveCmdEnvPrefix = "FULCIO_SERVE"
72+ defaultConfigPath string = "/etc/fulcio-config/config.yaml"
73+ )
7174
7275var serveCmdConfigFilePath string
7376
@@ -88,7 +91,7 @@ func newServeCmd() *cobra.Command {
8891 cmd .Flags ().String ("hsm-caroot-id" , "" , "HSM ID for Root CA (only used with --ca pkcs11ca)" )
8992 cmd .Flags ().String ("ct-log-url" , "http://localhost:6962/test" , "host and path (with log prefix at the end) to the ct log" )
9093 cmd .Flags ().String ("ct-log-public-key-path" , "" , "Path to a PEM-encoded public key of the CT log, used to verify SCTs" )
91- cmd .Flags ().String ("config-path" , "/etc/fulcio-config/config.yaml" , "path to fulcio config yaml" )
94+ cmd .Flags ().String ("config-path" , defaultConfigPath , "path to fulcio config yaml" )
9295 cmd .Flags ().String ("pkcs11-config-path" , "config/crypto11.conf" , "path to fulcio pkcs11 config file" )
9396 cmd .Flags ().String ("fileca-cert" , "" , "Path to CA certificate" )
9497 cmd .Flags ().String ("fileca-key" , "" , "Path to CA encrypted private key" )
@@ -212,6 +215,13 @@ func runServeCmd(cmd *cobra.Command, args []string) { //nolint: revive
212215 _ = flag .CommandLine .Parse ([]string {})
213216
214217 cp := viper .GetString ("config-path" )
218+ if cp == defaultConfigPath {
219+ if _ , err := os .Stat (cp ); os .IsNotExist (err ) {
220+ log .Logger .Warnf ("warn loading --config-path=%s: %v, fall back to json" , cp , err )
221+ cp = strings .TrimSuffix (cp , ".yaml" ) + ".json"
222+ }
223+ }
224+
215225 cfg , err := config .Load (cp )
216226 if err != nil {
217227 log .Logger .Fatalf ("error loading --config-path=%s: %v" , cp , err )
0 commit comments