warn if VCS configuration not supplied in production
Alan Pearce alan@alanpearce.eu
Tue, 02 Jul 2024 21:22:55 +0200
1 files changed, 16 insertions(+), 12 deletions(-)
jump to
M internal/server/server.go → internal/server/server.go
@@ -110,20 +110,24 @@ _, err := conf.Parse("VCS", vcsConfig) if err != nil { return nil, err } - _, err = vcs.CloneOrUpdate(vcsConfig, log.Named("vcs")) - if err != nil { - return nil, err - } - err = os.Chdir(runtimeConfig.Root) - if err != nil { - return nil, err - } + if vcsConfig.LocalPath != "" { + _, err = vcs.CloneOrUpdate(vcsConfig, log.Named("vcs")) + if err != nil { + return nil, err + } + err = os.Chdir(runtimeConfig.Root) + if err != nil { + return nil, err + } - builderConfig.Source = vcsConfig.LocalPath + builderConfig.Source = vcsConfig.LocalPath - publicDir := filepath.Join(runtimeConfig.Root, "public") - builderConfig.Destination = publicDir - runtimeConfig.Root = publicDir + publicDir := filepath.Join(runtimeConfig.Root, "public") + builderConfig.Destination = publicDir + runtimeConfig.Root = publicDir + } else { + log.Warn("in production mode without VCS configuration") + } } config, err := cfg.GetConfig(builderConfig.Source, log.Named("config"))