diff --git a/Dockerfile b/Dockerfile index 4285480..c96c2a5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,20 +3,24 @@ FROM golang:1.10 AS builder RUN curl -fsSL -o /usr/local/bin/dep https://github.com/golang/dep/releases/download/v0.4.1/dep-linux-amd64 \ && chmod +x /usr/local/bin/dep -RUN mkdir -p /go/src/github.com/WanderaOrg/scccmd/config -WORKDIR /go/src/github.com/WanderaOrg/scccmd/config +RUN mkdir -p /go/src/github.com/WanderaOrg/scccmd/ +WORKDIR /go/src/github.com/WanderaOrg/scccmd/ COPY Gopkg.toml Gopkg.lock ./ RUN dep ensure -vendor-only -COPY config/ . -RUN CGO_ENABLED=0 go build -o ../bin/config +COPY cmd/ ./cmd +COPY internal/ ./internal +COPY pkg/ ./pkg +COPY main.go . + +RUN CGO_ENABLED=0 go build -o bin/scccmd # Runtime image FROM alpine:latest RUN apk --no-cache add ca-certificates -COPY --from=builder /go/src/github.com/WanderaOrg/scccmd/bin/config /app/config +COPY --from=builder /go/src/github.com/WanderaOrg/scccmd/bin/scccmd /app/scccmd WORKDIR /app -ENTRYPOINT ["./config"] \ No newline at end of file +ENTRYPOINT ["./scccmd"] \ No newline at end of file diff --git a/config/cmd/decrypt.go b/cmd/decrypt.go similarity index 95% rename from config/cmd/decrypt.go rename to cmd/decrypt.go index 706fa4a..4c3aea1 100644 --- a/config/cmd/decrypt.go +++ b/cmd/decrypt.go @@ -2,7 +2,7 @@ package cmd import ( "fmt" - "github.com/WanderaOrg/scccmd/config/client" + "github.com/WanderaOrg/scccmd/pkg/client" "github.com/spf13/cobra" "io/ioutil" "os" diff --git a/config/cmd/decrypt_test.go b/cmd/decrypt_test.go similarity index 95% rename from config/cmd/decrypt_test.go rename to cmd/decrypt_test.go index e027f21..ca714bc 100644 --- a/config/cmd/decrypt_test.go +++ b/cmd/decrypt_test.go @@ -3,7 +3,7 @@ package cmd import ( "bytes" "fmt" - "github.com/WanderaOrg/scccmd/config/internal" + "github.com/WanderaOrg/scccmd/internal" "net/http" "net/http/httptest" "testing" diff --git a/config/cmd/encrypt.go b/cmd/encrypt.go similarity index 95% rename from config/cmd/encrypt.go rename to cmd/encrypt.go index 7be1458..0b4acfa 100644 --- a/config/cmd/encrypt.go +++ b/cmd/encrypt.go @@ -2,7 +2,7 @@ package cmd import ( "fmt" - "github.com/WanderaOrg/scccmd/config/client" + "github.com/WanderaOrg/scccmd/pkg/client" "github.com/spf13/cobra" "io/ioutil" "os" diff --git a/config/cmd/encrypt_test.go b/cmd/encrypt_test.go similarity index 95% rename from config/cmd/encrypt_test.go rename to cmd/encrypt_test.go index 3d7f1d5..c8d5006 100644 --- a/config/cmd/encrypt_test.go +++ b/cmd/encrypt_test.go @@ -3,7 +3,7 @@ package cmd import ( "bytes" "fmt" - "github.com/WanderaOrg/scccmd/config/internal" + "github.com/WanderaOrg/scccmd/internal" "net/http" "net/http/httptest" "testing" diff --git a/config/cmd/filemapping.go b/cmd/filemapping.go similarity index 100% rename from config/cmd/filemapping.go rename to cmd/filemapping.go diff --git a/config/cmd/filemapping_test.go b/cmd/filemapping_test.go similarity index 100% rename from config/cmd/filemapping_test.go rename to cmd/filemapping_test.go diff --git a/config/cmd/gendoc.go b/cmd/gendoc.go similarity index 100% rename from config/cmd/gendoc.go rename to cmd/gendoc.go diff --git a/config/cmd/get.go b/cmd/get.go similarity index 98% rename from config/cmd/get.go rename to cmd/get.go index 29749ad..04da030 100644 --- a/config/cmd/get.go +++ b/cmd/get.go @@ -2,7 +2,7 @@ package cmd import ( "fmt" - "github.com/WanderaOrg/scccmd/config/client" + "github.com/WanderaOrg/scccmd/pkg/client" "github.com/spf13/cobra" "io/ioutil" ) diff --git a/config/cmd/get_test.go b/cmd/get_test.go similarity index 100% rename from config/cmd/get_test.go rename to cmd/get_test.go diff --git a/config/cmd/initializer.go b/cmd/initializer.go similarity index 100% rename from config/cmd/initializer.go rename to cmd/initializer.go diff --git a/config/cmd/root.go b/cmd/root.go similarity index 96% rename from config/cmd/root.go rename to cmd/root.go index 33830da..55679e3 100644 --- a/config/cmd/root.go +++ b/cmd/root.go @@ -8,7 +8,7 @@ import ( var Verbose bool var rootCmd = &cobra.Command{ - Use: "config", + Use: "scccmd", DisableAutoGenTag: true, Short: "Spring Cloud Config management tool", Long: `Commandline tool used for managing configuration from Spring Cloud Config Server. diff --git a/config/cmd/root_test.go b/cmd/root_test.go similarity index 100% rename from config/cmd/root_test.go rename to cmd/root_test.go diff --git a/docs/config_init.md b/docs/config_init.md deleted file mode 100644 index f77b3eb..0000000 --- a/docs/config_init.md +++ /dev/null @@ -1,33 +0,0 @@ -## config init - -Initialize the config from the given config server - -### Synopsis - - -Initialize the config from the given config server - -``` -config init [flags] -``` - -### Options - -``` - -a, --application string name of the application to get the config for - -f, --files fileMappings files to get in form of source:destination pairs, example '--files application.yaml:config.yaml' - -h, --help help for init - -l, --label string configuration label (default "master") - -p, --profile string configuration profile (default "default") - -s, --source string address of the config server -``` - -### Options inherited from parent commands - -``` - -v, --verbose verbose output -``` - -### SEE ALSO -* [config](config.md) - Spring Cloud Config management tool - diff --git a/docs/config.md b/docs/scccmd.md similarity index 54% rename from docs/config.md rename to docs/scccmd.md index 3daeffa..10c2d4d 100644 --- a/docs/config.md +++ b/docs/scccmd.md @@ -1,4 +1,4 @@ -## config +## scccmd Spring Cloud Config management tool @@ -11,14 +11,14 @@ Tool currently provides functionality t get (download) config file from server. ### Options ``` - -h, --help help for config + -h, --help help for scccmd -v, --verbose verbose output ``` ### SEE ALSO -* [config decrypt](config_decrypt.md) - Decrypt the value server-side and prints the response -* [config encrypt](config_encrypt.md) - Encrypt the value server-side and prints the response -* [config gendoc](config_gendoc.md) - Generates documentation for this tool in Markdown format -* [config get](config_get.md) - Get the config from the given config server -* [config initializer](config_initializer.md) - Runs K8s initializer for injecting config from Cloud Config Server +* [scccmd decrypt](scccmd_decrypt.md) - Decrypt the value server-side and prints the response +* [scccmd encrypt](scccmd_encrypt.md) - Encrypt the value server-side and prints the response +* [scccmd gendoc](scccmd_gendoc.md) - Generates documentation for this tool in Markdown format +* [scccmd get](scccmd_get.md) - Get the config from the given config server +* [scccmd initializer](scccmd_initializer.md) - Runs K8s initializer for injecting config from Cloud Config Server diff --git a/docs/config_decrypt.md b/docs/scccmd_decrypt.md similarity index 80% rename from docs/config_decrypt.md rename to docs/scccmd_decrypt.md index d4b21f9..6516c1b 100644 --- a/docs/config_decrypt.md +++ b/docs/scccmd_decrypt.md @@ -1,4 +1,4 @@ -## config decrypt +## scccmd decrypt Decrypt the value server-side and prints the response @@ -8,7 +8,7 @@ Decrypt the value server-side and prints the response Decrypt the value server-side and prints the response ``` -config decrypt [flags] +scccmd decrypt [flags] ``` ### Options @@ -26,5 +26,5 @@ config decrypt [flags] ``` ### SEE ALSO -* [config](config.md) - Spring Cloud Config management tool +* [scccmd](scccmd.md) - Spring Cloud Config management tool diff --git a/docs/config_encrypt.md b/docs/scccmd_encrypt.md similarity index 80% rename from docs/config_encrypt.md rename to docs/scccmd_encrypt.md index 2d6f540..88b892e 100644 --- a/docs/config_encrypt.md +++ b/docs/scccmd_encrypt.md @@ -1,4 +1,4 @@ -## config encrypt +## scccmd encrypt Encrypt the value server-side and prints the response @@ -8,7 +8,7 @@ Encrypt the value server-side and prints the response Encrypt the value server-side and prints the response ``` -config encrypt [flags] +scccmd encrypt [flags] ``` ### Options @@ -26,5 +26,5 @@ config encrypt [flags] ``` ### SEE ALSO -* [config](config.md) - Spring Cloud Config management tool +* [scccmd](scccmd.md) - Spring Cloud Config management tool diff --git a/docs/config_gendoc.md b/docs/scccmd_gendoc.md similarity index 78% rename from docs/config_gendoc.md rename to docs/scccmd_gendoc.md index 35ea0fc..c73710f 100644 --- a/docs/config_gendoc.md +++ b/docs/scccmd_gendoc.md @@ -1,4 +1,4 @@ -## config gendoc +## scccmd gendoc Generates documentation for this tool in Markdown format @@ -8,7 +8,7 @@ Generates documentation for this tool in Markdown format Generates documentation for this tool in Markdown format ``` -config gendoc [flags] +scccmd gendoc [flags] ``` ### Options @@ -25,5 +25,5 @@ config gendoc [flags] ``` ### SEE ALSO -* [config](config.md) - Spring Cloud Config management tool +* [scccmd](scccmd.md) - Spring Cloud Config management tool diff --git a/docs/config_get.md b/docs/scccmd_get.md similarity index 75% rename from docs/config_get.md rename to docs/scccmd_get.md index 8673375..9deddf9 100644 --- a/docs/config_get.md +++ b/docs/scccmd_get.md @@ -1,4 +1,4 @@ -## config get +## scccmd get Get the config from the given config server @@ -24,7 +24,7 @@ Get the config from the given config server ``` ### SEE ALSO -* [config](config.md) - Spring Cloud Config management tool -* [config get files](config_get_files.md) - Get the config files from the given config server -* [config get values](config_get_values.md) - Get the config values in specified format from the given config server +* [scccmd](scccmd.md) - Spring Cloud Config management tool +* [scccmd get files](scccmd_get_files.md) - Get the config files from the given config server +* [scccmd get values](scccmd_get_values.md) - Get the config values in specified format from the given config server diff --git a/docs/config_get_files.md b/docs/scccmd_get_files.md similarity index 86% rename from docs/config_get_files.md rename to docs/scccmd_get_files.md index 426f19a..96804dc 100644 --- a/docs/config_get_files.md +++ b/docs/scccmd_get_files.md @@ -1,4 +1,4 @@ -## config get files +## scccmd get files Get the config files from the given config server @@ -8,7 +8,7 @@ Get the config files from the given config server Get the config files from the given config server ``` -config get files [flags] +scccmd get files [flags] ``` ### Options @@ -29,5 +29,5 @@ config get files [flags] ``` ### SEE ALSO -* [config get](config_get.md) - Get the config from the given config server +* [scccmd get](scccmd_get.md) - Get the config from the given config server diff --git a/docs/config_get_values.md b/docs/scccmd_get_values.md similarity index 87% rename from docs/config_get_values.md rename to docs/scccmd_get_values.md index 26bb4e0..ac5ae9f 100644 --- a/docs/config_get_values.md +++ b/docs/scccmd_get_values.md @@ -1,4 +1,4 @@ -## config get values +## scccmd get values Get the config values in specified format from the given config server @@ -8,7 +8,7 @@ Get the config values in specified format from the given config server Get the config values in specified format from the given config server ``` -config get values [flags] +scccmd get values [flags] ``` ### Options @@ -30,5 +30,5 @@ config get values [flags] ``` ### SEE ALSO -* [config get](config_get.md) - Get the config from the given config server +* [scccmd get](scccmd_get.md) - Get the config from the given config server diff --git a/docs/config_initializer.md b/docs/scccmd_initializer.md similarity index 88% rename from docs/config_initializer.md rename to docs/scccmd_initializer.md index f09952c..a6cc512 100644 --- a/docs/config_initializer.md +++ b/docs/scccmd_initializer.md @@ -1,4 +1,4 @@ -## config initializer +## scccmd initializer Runs K8s initializer for injecting config from Cloud Config Server @@ -8,7 +8,7 @@ Runs K8s initializer for injecting config from Cloud Config Server Runs K8s initializer for injecting config from Cloud Config Server ``` -config initializer [flags] +scccmd initializer [flags] ``` ### Options @@ -28,5 +28,5 @@ config initializer [flags] ``` ### SEE ALSO -* [config](config.md) - Spring Cloud Config management tool +* [scccmd](scccmd.md) - Spring Cloud Config management tool diff --git a/config/internal/testutil.go b/internal/testutil.go similarity index 100% rename from config/internal/testutil.go rename to internal/testutil.go diff --git a/config/main.go b/main.go similarity index 71% rename from config/main.go rename to main.go index d7ebcf2..32d262b 100644 --- a/config/main.go +++ b/main.go @@ -1,7 +1,7 @@ package main import ( - "github.com/WanderaOrg/scccmd/config/cmd" + "github.com/WanderaOrg/scccmd/cmd" "os" ) diff --git a/config/client/client.go b/pkg/client/client.go similarity index 100% rename from config/client/client.go rename to pkg/client/client.go diff --git a/config/client/client_test.go b/pkg/client/client_test.go similarity index 98% rename from config/client/client_test.go rename to pkg/client/client_test.go index 42214fe..6a39eb9 100644 --- a/config/client/client_test.go +++ b/pkg/client/client_test.go @@ -3,7 +3,7 @@ package client import ( "bytes" "fmt" - "github.com/WanderaOrg/scccmd/config/internal" + "github.com/WanderaOrg/scccmd/internal" "net/http" "net/http/httptest" "testing"