Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support for grafana config #1017

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions api/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ type Sentry struct {
Platform string `json:"platform,omitempty" example:"dev"`
}

// Sentry - config for grafana settings.
type Grafana struct {
URL string `json:"url,omitempty" example:"https://grafana.com/"`
}

// Config for api configuration variables.
type Config struct {
EnableCORS bool
Expand Down Expand Up @@ -68,6 +73,7 @@ type WebConfig struct {
Contacts []WebContact `json:"contacts"`
FeatureFlags FeatureFlags `json:"featureFlags"`
Sentry Sentry `json:"sentry"`
Grafana Grafana `json:"grafana,omitempty"`
}

// MetricSourceCluster contains data about supported metric source cluster.
Expand Down
13 changes: 13 additions & 0 deletions cmd/api/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,16 @@ func (config *sentryConfig) getSettings() api.Sentry {
}
}

type grafanaConfig struct {
URL string `yaml:"url"`
}

func (config *grafanaConfig) getSettings() api.Grafana {
return api.Grafana{
URL: config.URL,
}
}

type webConfig struct {
// Moira administrator email address.
SupportEmail string `yaml:"supportEmail"`
Expand All @@ -80,6 +90,8 @@ type webConfig struct {
FeatureFlags featureFlags `yaml:"feature_flags"`
// Returns the sentry configuration for the frontend.
Sentry sentryConfig `yaml:"sentry"`
// Returns the grafana configuration for the frontend.
Grafana grafanaConfig `yaml:"grafana"`
}

type webContact struct {
Expand Down Expand Up @@ -174,6 +186,7 @@ func (config *webConfig) getSettings(isRemoteEnabled bool, remotes cmd.RemotesCo
Contacts: webContacts,
FeatureFlags: config.getFeatureFlags(),
Sentry: config.Sentry.getSettings(),
Grafana: config.Grafana.getSettings(),
}
}

Expand Down
2 changes: 2 additions & 0 deletions local/api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ web:
is_plotting_default_on: true
is_subscription_to_all_tags_available: true
is_readonly_enabled: false
grafana:
url: grafana.ru
notification_history:
ttl: 48h
query_limit: 10000
Expand Down
Loading