fix: show defaults log only when actually applying defaults

This commit is contained in:
2025-12-09 01:28:15 +02:00
parent a5baf30836
commit 989515ff28
2 changed files with 8 additions and 2 deletions

View File

@@ -137,6 +137,14 @@ func RunInstaller(config *appconfig.AppConfig, installer IInstaller) error {
info := installer.GetData()
name := *info.Name
curOS := platform.GetPlatform()
// Log if defaults were applied for this installer type
if config.Defaults != nil && config.Defaults.Type != nil {
if _, ok := (*config.Defaults.Type)[info.Type]; ok {
logger.Debug("Applying defaults for %s", info.Type)
}
}
logger.Debug("Checking if %s (%s) should run on %s", name, info.Type, curOS)
env := config.Environ()
if !installer.GetData().Platforms.GetShouldRunOnOS(curOS) {

View File

@@ -2,7 +2,6 @@ package installer
import (
"github.com/chenasraf/sofmani/appconfig"
"github.com/chenasraf/sofmani/logger"
"github.com/chenasraf/sofmani/platform"
"maps"
)
@@ -20,7 +19,6 @@ func InstallerWithDefaults(
// per-type overrides from defaults
if defaults != nil && defaults.Type != nil {
if override, ok := (*defaults.Type)[installerType]; ok {
logger.Debug("Applying defaults for %s", installerType)
if override.Opts != nil {
source := *override.Opts
target := *data.Opts