@@ -83,14 +83,22 @@ func loadEnvConfigMap(cfgPath string) EnvSpecMap {
83
83
84
84
pathList := listAllPath (envPath ).Expect ("failed to list env config path: %s" , envPath )
85
85
for _ , p := range pathList {
86
- envConfigBytes := result .Wrap (os .ReadFile (p )).Expect ("failed to handler env config data, path=%s" , p )
87
- envConfigBytes = bytes .TrimSpace (envConfigBytes )
86
+ envConfigBytes := result .Wrap (os .ReadFile (p )).
87
+ Map (bytes .TrimSpace ).
88
+ Must (func (e * zerolog.Event ) {
89
+ e .Str (logfields .Msg , fmt .Sprintf ("failed to handler env config data, path=%s" , p ))
90
+ })
88
91
if len (envConfigBytes ) == 0 {
89
92
continue
90
93
}
91
94
92
- envConfigBytes = result .Wrap (envsubst .Bytes (envConfigBytes )).Expect ("failed to handler config env data: %s" , envConfigBytes )
93
- assert .MustF (yaml .Unmarshal (envConfigBytes , & envSpecMap ), "failed to unmarshal env config, data=%s path=%s" , envConfigBytes , p )
95
+ envConfigBytes = cfgFormat (envConfigBytes , & config {workDir : filepath .Dir (cfgPath )})
96
+ envConfigBytes = result .Wrap (envsubst .Bytes (envConfigBytes )).Must (func (e * zerolog.Event ) {
97
+ e .Str (logfields .Msg , fmt .Sprintf ("failed to handler config env data: %s" , envConfigBytes ))
98
+ })
99
+ result .Must (yaml .Unmarshal (envConfigBytes , & envSpecMap ), func (e * zerolog.Event ) {
100
+ e .Str (logfields .Msg , fmt .Sprintf ("failed to unmarshal env config, data=%s path=%s" , envConfigBytes , p ))
101
+ })
94
102
}
95
103
}
96
104
initEnv (envSpecMap )
0 commit comments