@@ -17,6 +17,7 @@ import (
1717 "k8s.io/client-go/rest"
1818 "k8s.io/client-go/tools/clientcmd"
1919
20+ envtypes "github.com/openshift-online/maestro/cmd/maestro/environments/types"
2021 "open-cluster-management.io/sdk-go/pkg/cloudevents/generic"
2122)
2223
@@ -27,16 +28,13 @@ func init() {
2728 // Create the configuration
2829 environment .Config = config .NewApplicationConfig ()
2930 environment .ApplicationConfig = ApplicationConfig {config .NewApplicationConfig ()}
30- environment .Name = GetEnvironmentStrFromEnv ()
31+ environment .Name = envtypes . GetEnvironmentStrFromEnv ()
3132
3233 environments = map [string ]EnvironmentImpl {
33- DevelopmentEnv : & devEnvImpl {environment },
34- TestingEnv : & testingEnvImpl {environment },
35- ProductionEnv : & productionEnvImpl {environment },
34+ envtypes . DevelopmentEnv : & devEnvImpl {environment },
35+ envtypes . TestingEnv : & testingEnvImpl {environment },
36+ envtypes . ProductionEnv : & productionEnvImpl {environment },
3637 }
37-
38- // initialize the logger
39- logger .InitLogger (environment .Name )
4038 })
4139}
4240
@@ -59,14 +57,6 @@ type EnvironmentImpl interface {
5957 VisitClients (c * Clients ) error
6058}
6159
62- func GetEnvironmentStrFromEnv () string {
63- envStr , specified := os .LookupEnv (EnvironmentStringKey )
64- if ! specified || envStr == "" {
65- envStr = EnvironmentDefault
66- }
67- return envStr
68- }
69-
7060func Environment () * Env {
7161 return environment
7262}
@@ -269,7 +259,7 @@ func (e *Env) InitializeSentry() error {
269259}
270260
271261func (e * Env ) Teardown () {
272- if e .Name != TestingEnv {
262+ if e .Name != envtypes . TestingEnv {
273263 if err := e .Database .SessionFactory .Close (); err != nil {
274264 log .Fatalf ("Unable to close db connection: %s" , err .Error ())
275265 }
0 commit comments