Persist server configuration to config file

This commit is contained in:
2023-02-25 01:24:22 -07:00
parent a41c12d20c
commit 3fef157f6a
7 changed files with 110 additions and 53 deletions
+33 -24
View File
@@ -4,8 +4,10 @@ import (
"fmt"
"os"
"git.ohea.xyz/cursorius/tui/screens"
tea "github.com/charmbracelet/bubbletea"
"git.ohea.xyz/cursorius/tui/screens"
"git.ohea.xyz/cursorius/tui/settings"
)
type model struct {
@@ -55,31 +57,38 @@ func (m model) View() string {
}
func main() {
conf, err := settings.GetConfig()
if err != nil {
fmt.Printf("Error: %v", err)
return
}
initialModel := model{
screen: screens.CreateLogin(
// TODO: load from config file
[]screens.CursoriusServer{
{
Name: "local-test",
Url: "http://127.0.0.1:45421/graphql",
Token: "",
},
{
Name: "ohea",
Url: "https://ci.cursorius.server",
Token: "test",
},
{
Name: "nohea",
Url: "https://ci.cursoriuspreview.server",
Token: "test",
},
{
Name: "work",
Url: "https://ci.acme.corp",
Token: "test",
},
},
conf,
//[]screens.CursoriusServer{
// {
// Name: "local-test",
// Url: "http://127.0.0.1:45421/graphql",
// Token: "",
// },
// {
// Name: "ohea",
// Url: "https://ci.cursorius.server",
// Token: "test",
// },
// {
// Name: "nohea",
// Url: "https://ci.cursoriuspreview.server",
// Token: "test",
// },
// {
// Name: "work",
// Url: "https://ci.acme.corp",
// Token: "test",
// },
//},
),
}