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

GUI server config #428

Merged
merged 2 commits into from
Nov 14, 2019
Merged

GUI server config #428

merged 2 commits into from
Nov 14, 2019

Conversation

jakubdyszkiewicz
Copy link
Contributor

Summary

The problem is that even if we expose the GUI on some port, the API is on a different one. We need to deliver configuration about API coordinates. To do this, we can expose /config endpoint with configuration.

I used similar pattern to Catalog for now, which is keep it as Kuma Config, but don't expose env vars/yaml. Autoconfig everything.

Once we get more options for frontend, we can put it in the GuiConfig and use standard way to configure Kuma CP to configure embedded frontend.

Also I exposed the environment variable, to display if kuma is running on k8s or not on the GUI.

pkg/config/gui-server/config.go Show resolved Hide resolved
pkg/gui/gui_config.go Outdated Show resolved Hide resolved
pkg/gui/gui_config.go Outdated Show resolved Hide resolved
func FromServerConfig(config gui_server.GuiConfig) GuiConfig {
return GuiConfig{
ApiUrl: config.ApiUrl,
Environment: config.Environment,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly to the earlier comment, why do we configure Environment separately leaving a room for a contradiction between ApiUrl and Environment ?

Environment string `json:"environment"`
}

func FromServerConfig(config gui_server.GuiConfig) GuiConfig {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's keep FromServerConfig() func in a package other than types/ (e.g., in server/ rather than server/types/)

Motivation: to make it clear that REST API doesn't depend on config types

@jakubdyszkiewicz jakubdyszkiewicz changed the base branch from feature/static-server to master November 13, 2019 19:47
writer.WriteHeader(500)
return
}
if _, err := writer.Write(bytes); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's set Content-Type: application/json

@jakubdyszkiewicz jakubdyszkiewicz merged commit 28c7ec7 into master Nov 14, 2019
@jakubdyszkiewicz jakubdyszkiewicz deleted the feature/gui-server-config branch November 14, 2019 09:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants