-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixup: add start command, docker stuff
Signed-off-by: Todd Baert <[email protected]>
- Loading branch information
Showing
18 changed files
with
141 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
.idea | ||
node_modules | ||
flags/changing-flag.json | ||
flags/changing-flag.json | ||
bin/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.PHONY: clean | ||
clean: | ||
rm -R bin/ | ||
.PHONY: build-sync | ||
build-sync: | ||
cd sync && go build -o ./bin/sync |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
FROM busybox:1.36 | ||
|
||
COPY sync/bin/* . | ||
COPY flags/* . | ||
COPY scripts/* . | ||
LABEL org.opencontainers.image.source = "https://github.com/open-feature/test-harness" | ||
|
||
ENTRYPOINT ["sh", "wrapper.sh", "./sync", "start", "-f", "testing-flags.json", "-f", "changing-flag.json"] |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package main | ||
|
||
import ( | ||
sync "github.com/open-feature/test-harness/sync/pkg" | ||
) | ||
|
||
func main() { | ||
server := sync.Server{ | ||
Config: sync.LoadConfig(), | ||
} | ||
|
||
server.Start() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package sync | ||
|
||
import ( | ||
"flag" | ||
"fmt" | ||
"os" | ||
) | ||
|
||
const hostDefault = "0.0.0.0" | ||
const portDefault = "9090" | ||
const cmdDefault = "start" | ||
|
||
// arrayFlags is a custom flag implementation | ||
type arrayFlags struct { | ||
Array []string | ||
} | ||
|
||
func (i *arrayFlags) String() string { | ||
return fmt.Sprint(i.Array) | ||
} | ||
|
||
func (i *arrayFlags) Set(value string) error { | ||
i.Array = append(i.Array, value) | ||
return nil | ||
} | ||
|
||
type Config struct { | ||
Command string | ||
Host string | ||
Port string | ||
Secure bool | ||
Files arrayFlags | ||
CertPath string | ||
KeyPath string | ||
} | ||
|
||
func LoadConfig() Config { | ||
cfg := Config{} | ||
|
||
start := flag.NewFlagSet("start", flag.ExitOnError) | ||
start.StringVar(&cfg.Host, "h", hostDefault, "hostDefault of the server") | ||
start.StringVar(&cfg.Port, "p", portDefault, "portDefault of the server") | ||
start.Var(&cfg.Files, "f", "file to watch") | ||
start.BoolVar(&cfg.Secure, "s", false, "enable tls") | ||
start.StringVar(&cfg.CertPath, "certPath", "", "certificate path for tls connection") | ||
start.StringVar(&cfg.KeyPath, "keyPath", "", "certificate key for tls connection") | ||
start.Parse(os.Args[2:]) | ||
|
||
return cfg | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters