Skip to content

Commit

Permalink
make rulerAPIPath configurable (#19)
Browse files Browse the repository at this point in the history
* make rulerAPIPath configurable

Co-authored-by: Friedrich Gonzalez <[email protected]>
Signed-off-by: Jan Willies <[email protected]>

* Include flags for ruler command

Signed-off-by: Friedrich Gonzalez <[email protected]>

---------

Signed-off-by: Jan Willies <[email protected]>
Signed-off-by: Friedrich Gonzalez <[email protected]>
Co-authored-by: Friedrich Gonzalez <[email protected]>
  • Loading branch information
janwillies and friedrichg authored Nov 1, 2023
1 parent 58aa76d commit 76a414b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ type Config struct {
TLS tls.ClientConfig
UseLegacyRoutes bool `yaml:"use_legacy_routes"`
AuthToken string `yaml:"auth_token"`
RulerAPIPath string `yaml:"ruler_api_path"`
}

// CortexClient is used to get and load rules into a cortex ruler
Expand Down Expand Up @@ -82,6 +83,9 @@ func New(cfg Config) (*CortexClient, error) {
}

path := rulerAPIPath
if cfg.RulerAPIPath != "" {
path = cfg.RulerAPIPath
}
if cfg.UseLegacyRoutes {
path = legacyAPIPath
}
Expand Down
5 changes: 5 additions & 0 deletions pkg/commands/rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,11 @@ func (r *RuleCommand) Register(app *kingpin.Application) {
Envar("CORTEX_USE_LEGACY_ROUTES").
BoolVar(&r.ClientConfig.UseLegacyRoutes)

c.Flag("ruler-api-path", "if set, API requests to cortex will use an alternative path for the ruler API, alternatively set CORTEX_RULER_API_PATH. The default is /api/v1/rules").
Default("").
Envar("CORTEX_RULER_API_PATH").
StringVar(&r.ClientConfig.RulerAPIPath)

c.Flag("tls-ca-path", "TLS CA certificate to verify cortex API as part of mTLS, alternatively set CORTEX_TLS_CA_PATH.").
Default("").
Envar("CORTEX_TLS_CA_CERT").
Expand Down

0 comments on commit 76a414b

Please sign in to comment.