@@ -28,9 +28,10 @@ import (
2828func main () {
2929 // Initialize options with defaults
3030 opts := proxy .NewOptions ()
31+ opts .FlagSet = pflag .CommandLine
3132
3233 // Add options flags (including logging flags)
33- opts .AddFlags (pflag . CommandLine )
34+ opts .AddFlags (opts . FlagSet )
3435 pflag .Parse ()
3536
3637 logger := opts .NewLogger ()
@@ -52,6 +53,8 @@ func main() {
5253 }
5354 }()
5455 }
56+ // GetConfigurationState calculates whether configuration is from default values, flags or environment variables
57+ opts .GetConfigurationState ()
5558
5659 // Complete options (handles migration from deprecated flags, populates Config)
5760 if err := opts .Complete (); err != nil {
@@ -65,6 +68,27 @@ func main() {
6568 return
6669 }
6770
71+ if len (opts .ConfigurationState .Defaults ) != 0 {
72+ logger .Info ("Sidecar Configuration" ,
73+ "Configuration with default values" , opts .ConfigurationState .Defaults )
74+ }
75+ if len (opts .ConfigurationState .FromEnv ) != 0 {
76+ logger .Info ("Sidecar Configuration" ,
77+ "Configuration from environment variables" , opts .ConfigurationState .FromEnv )
78+ }
79+ if len (opts .ConfigurationState .FromFlags ) != 0 {
80+ logger .Info ("Sidecar Configuration" ,
81+ "Configuration from flags" , opts .ConfigurationState .FromFlags )
82+ }
83+ if len (opts .ConfigurationState .FromInline ) != 0 {
84+ logger .Info ("Sidecar Configuration" ,
85+ "Configuration from inline-specification i.e. `--configuration` flag" , opts .ConfigurationState .FromInline )
86+ }
87+ if len (opts .ConfigurationState .FromFile ) != 0 {
88+ logger .Info ("Sidecar Configuration" ,
89+ "Configuration from file i.e. `--configuration-file` flag" , opts .ConfigurationState .FromFile )
90+ }
91+
6892 logger .Info ("Proxy starting" , "Built on" , version .BuildRef , "From Git SHA" , version .CommitSHA )
6993 logger .Info ("Proxy configuration" , "config" , opts .Config )
7094
0 commit comments