Skip to content

Remote Config Support #2114

@akshat-kumar-singhal

Description

@akshat-kumar-singhal

Background
Gofr support remote log level configuration. This can be extended to allow remote updating other configurations as well.

Proposal
A new interface which can be implemented by any receiver which supports reloading based on configuration at runtime. Remote Config
High level implementation as below:

// structs implementing RemoteConfigurable interface are responsible to update/reload the internal config and make it available in-place, i.e. not require restarting the application
type RemoteConfigurable interface {
  refreshConfig(config map[string]string) error
}

type RemoteConfiguration interface {
  registerReceiver(receiver RemoteConfigurable) bool
  fetchRemoteConfig() error
}

// TODO: this can be moved to a common package as it's used in other places like JWKS fetch as well
// TODO: better name can be given for this interface 
type HTTPGetProvider interface {
   GetWithHeaders(ctx context.Context, path string, queryParams map[string]any,
		headers map[string]string) (*http.Response, error)
}

// GofrRemoteConfig implements RemoteConfiguration interface 
type GofrRemoteConfig struct {
  provider HTTPGetProvider
  receivers RemoteConfigurable
// refreshFrequency configuration
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    triageThe issue needs triaging.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions