diff --git a/config/config.go b/config/config.go index cf0cd38d..fac6e832 100644 --- a/config/config.go +++ b/config/config.go @@ -467,6 +467,15 @@ func GetJwtAlgorithm() *jwt.HMACSHA { // and will only allow one write at a time. Additional calls while writing are // queued up. func WriteToDisk(c *Configuration) error { + + // If the environment variable is set, skip actual writes. Useful for containers + // or managed environments where you want Wings to never modify files. + if os.Getenv("WINGS_NO_CONFIG_WRITE") == "1" { + // Note: use your logger package as appropriate; using apex/log.Logger in this file + // may require importing it. For clarity we keep this a simple no-op. + return nil + } + _writeLock.Lock() defer _writeLock.Unlock() diff --git a/config/config_docker.go b/config/config_docker.go index f3e846b0..df90e77b 100644 --- a/config/config_docker.go +++ b/config/config_docker.go @@ -103,9 +103,23 @@ func (c DockerConfiguration) ContainerLogConfig() container.LogConfig { return container.LogConfig{} } + // Filter config options based on the logging driver type + // The "local" driver has specific options that aren't compatible with other drivers + config := make(map[string]string) + for k, v := range c.LogConfig.Config { + // Only include these options if using the "local" driver + if c.LogConfig.Type != "local" { + // Exclude local-specific options for non-local drivers like fluentd, json-file, etc. + if k == "max-size" || k == "max-file" || k == "compress" || k == "mode" { + continue + } + } + config[k] = v + } + return container.LogConfig{ Type: c.LogConfig.Type, - Config: c.LogConfig.Config, + Config: config, } }