Skip to content

Commit 9e02923

Browse files
ndyakovCopilot
andauthored
Update examples/entraid/config/config.go
Co-authored-by: Copilot <[email protected]>
1 parent 14962ea commit 9e02923

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

examples/entraid/config/config.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,17 @@ func LoadConfig(configPath string) (*EntraidConfig, error) {
4545
file, err := os.Open(configPath)
4646
if err != nil {
4747
file, err = os.Open("endpoints.json")
48-
}
49-
50-
if err == nil {
51-
defer file.Close()
52-
decoder := json.NewDecoder(file)
53-
err = decoder.Decode(&config.Endpoints)
5448
if err != nil {
55-
return nil, err
49+
return nil, fmt.Errorf("failed to open configuration file: %v", err)
5650
}
5751
}
5852

53+
defer file.Close()
54+
decoder := json.NewDecoder(file)
55+
err = decoder.Decode(&config.Endpoints)
56+
if err != nil {
57+
return nil, fmt.Errorf("failed to decode configuration file: %v", err)
58+
}
5959
// Override with environment variables if they exist
6060
if envClientID := os.Getenv("AZURE_CLIENT_ID"); envClientID != "" {
6161
config.AzureClientID = envClientID

0 commit comments

Comments
 (0)