Skip to content

Commit

Permalink
Add initial project sync
Browse files Browse the repository at this point in the history
  • Loading branch information
dmashuda committed Dec 4, 2024
1 parent 8caf826 commit da29874
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
11 changes: 10 additions & 1 deletion cmd/dev_server/start_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package dev_server

import (
"context"
"encoding/json"
"errors"
"log"
"os/exec"
Expand Down Expand Up @@ -45,13 +46,21 @@ func startServer(client dev_server.Client) func(*cobra.Command, []string) error
ctx := context.Background()

var initialSetting dev_server.InitialProjectSettings
//ldContext := viper.GetString(ContextFlag)

if viper.IsSet(cliflags.ProjectFlag) && viper.IsSet(SourceEnvironmentFlag) {

initialSetting = dev_server.InitialProjectSettings{
Enabled: true,
ProjectKey: viper.GetString(cliflags.ProjectFlag),
EnvKey: viper.GetString(SourceEnvironmentFlag),
}
if viper.IsSet(ContextFlag) {
contextString := viper.GetString(ContextFlag)
err := json.Unmarshal([]byte(contextString), &initialSetting.Context)
if err != nil {
return err
}
}
}

params := dev_server.ServerParams{
Expand Down
3 changes: 2 additions & 1 deletion internal/dev_server/dev_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,10 @@ type ServerParams struct {
}

type InitialProjectSettings struct {
Enabled bool
ProjectKey string
EnvKey string
Context *ldcontext.Context
Context ldcontext.Context
}

type LDClient struct {
Expand Down

0 comments on commit da29874

Please sign in to comment.