-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Addressing Org Membership Inconsistency (#263)
* Addressing Organizational Potential Inconsistencies. ChangeLog: - When Listing Orgs, making preferences an optional parameter. - If Orgs exist that the configured Grafana Admin does not have access to, prompts user to fix it or abort. - Adds Retry Logic to Grafana OpenAPI client as well as Orgs Listing. - Addressing code review comments
- Loading branch information
1 parent
c0fb877
commit 5b1a706
Showing
18 changed files
with
410 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,39 @@ | ||
package config | ||
|
||
import ( | ||
"log/slog" | ||
"time" | ||
) | ||
|
||
// AppGlobals is the global configuration for the application | ||
type AppGlobals struct { | ||
Debug bool `mapstructure:"debug" yaml:"debug"` | ||
IgnoreSSLErrors bool `mapstructure:"ignore_ssl_errors" yaml:"ignore_ssl_errors"` | ||
Debug bool `mapstructure:"debug" yaml:"debug"` | ||
IgnoreSSLErrors bool `mapstructure:"ignore_ssl_errors" yaml:"ignore_ssl_errors"` | ||
RetryCount int `mapstructure:"retry_count" yaml:"retry_count"` | ||
RetryDelay string `mapstructure:"retry_delay" yaml:"retry_delay"` | ||
retryTimeout *time.Duration `mapstructure:"-" yaml:"-"` | ||
} | ||
|
||
// GetRetryTimeout returns 100ms, by default otherwise the parsed value | ||
func (app *AppGlobals) GetRetryTimeout() time.Duration { | ||
defaultBehavior := func() { | ||
d := time.Millisecond * 100 | ||
app.retryTimeout = &d | ||
} | ||
if app.RetryDelay == "" { | ||
defaultBehavior() | ||
} | ||
if app.retryTimeout != nil { | ||
return *app.retryTimeout | ||
} | ||
d, err := time.ParseDuration(app.RetryDelay) | ||
if err != nil { | ||
slog.Warn("Unable to parse the retry_delay value. Falling back on default to 100ms") | ||
defaultBehavior() | ||
} else { | ||
app.retryTimeout = &d | ||
} | ||
|
||
return *app.retryTimeout | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.