Display config on operator start up
This commit is contained in:
		
							parent
							
								
									a97dfb07de
								
							
						
					
					
						commit
						310c119dfa
					
				|  | @ -60,7 +60,7 @@ func ControllerConfig() *controller.Config { | ||||||
| func main() { | func main() { | ||||||
| 	log.SetOutput(os.Stdout) | 	log.SetOutput(os.Stdout) | ||||||
| 	log.Printf("Spilo operator %s\n", version) | 	log.Printf("Spilo operator %s\n", version) | ||||||
| 	log.Printf("ServiceAccountName: %s\n", cfg.ServiceAccountName) | 	log.Printf("Config: %s", cfg.MustMarshal()) | ||||||
| 
 | 
 | ||||||
| 	sigs := make(chan os.Signal, 1) | 	sigs := make(chan os.Signal, 1) | ||||||
| 	stop := make(chan struct{}) | 	stop := make(chan struct{}) | ||||||
|  |  | ||||||
|  | @ -3,6 +3,7 @@ package config | ||||||
| import ( | import ( | ||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"time" | 	"time" | ||||||
|  | 	"encoding/json" | ||||||
| 
 | 
 | ||||||
| 	"github.com/kelseyhightower/envconfig" | 	"github.com/kelseyhightower/envconfig" | ||||||
| ) | ) | ||||||
|  | @ -49,3 +50,12 @@ func LoadFromEnv() *Config { | ||||||
| 
 | 
 | ||||||
| 	return &cfg | 	return &cfg | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | func (c Config) MustMarshal() string { | ||||||
|  | 	b, err := json.MarshalIndent(c, "", "\t") | ||||||
|  | 	if err != nil { | ||||||
|  | 		panic(err) | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	return string(b) | ||||||
|  | } | ||||||
		Loading…
	
		Reference in New Issue