[ci skip] more codex 5.3 improvements
This commit is contained in:
24
main.go
24
main.go
@@ -29,8 +29,6 @@ var (
|
||||
bindDisableTls bool
|
||||
sha1ver string // sha1 revision used to build the program
|
||||
buildTime string // when the executable was built
|
||||
cronFrequency time.Duration
|
||||
cronInvFrequency time.Duration
|
||||
cronSnapshotFrequency time.Duration
|
||||
cronAggregateFrequency time.Duration
|
||||
)
|
||||
@@ -66,6 +64,7 @@ func main() {
|
||||
s.Logger = logger
|
||||
|
||||
logger.Info("vCTP starting", "build_time", buildTime, "sha1_version", sha1ver, "go_version", runtime.Version(), "settings_file", *settingsPath)
|
||||
warnDeprecatedPollingSettings(logger, s.Values)
|
||||
|
||||
// Configure database
|
||||
dbDriver := strings.TrimSpace(s.Values.Settings.DatabaseDriver)
|
||||
@@ -137,7 +136,10 @@ func main() {
|
||||
// Generate certificate if required
|
||||
if !(utils.FileExists(tlsCertFilename) && utils.FileExists(tlsKeyFilename)) {
|
||||
logger.Warn("Specified TLS certificate or private key do not exist", "certificate", tlsCertFilename, "tls-key", tlsKeyFilename)
|
||||
utils.GenerateCerts(tlsCertFilename, tlsKeyFilename)
|
||||
if err := utils.GenerateCerts(tlsCertFilename, tlsKeyFilename); err != nil {
|
||||
logger.Error("failed to generate TLS cert/key", "error", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
// Load vcenter credentials from settings, decrypt if required.
|
||||
@@ -338,6 +340,22 @@ func alignStart(now time.Time, freq time.Duration) time.Time {
|
||||
return now.Add(freq)
|
||||
}
|
||||
|
||||
func warnDeprecatedPollingSettings(logger *slog.Logger, cfg *settings.SettingsYML) {
|
||||
if cfg == nil {
|
||||
return
|
||||
}
|
||||
if cfg.Settings.VcenterEventPollingSeconds > 0 {
|
||||
logger.Warn("vcenter_event_polling_seconds is deprecated and ignored; snapshot lifecycle processing is used instead",
|
||||
"value", cfg.Settings.VcenterEventPollingSeconds,
|
||||
)
|
||||
}
|
||||
if cfg.Settings.VcenterInventoryPollingSeconds > 0 {
|
||||
logger.Warn("vcenter_inventory_polling_seconds is deprecated and ignored; hourly snapshot jobs are used instead",
|
||||
"value", cfg.Settings.VcenterInventoryPollingSeconds,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
func durationFromSeconds(value int, fallback int) time.Duration {
|
||||
if value <= 0 {
|
||||
return time.Second * time.Duration(fallback)
|
||||
|
||||
Reference in New Issue
Block a user