From bff96e2e2580e72f1b4a84e5135468fa3292ae1f Mon Sep 17 00:00:00 2001 From: Yngvar Kristiansen <562343+yngvark@users.noreply.github.com> Date: Mon, 19 Aug 2024 16:11:56 +0200 Subject: [PATCH] feat!: Rename BASE_URL to OK_BASE_URL --- cmd/pkg/install.go | 4 ++-- pkg/pkg/install/install.go | 3 ++- pkg/pkg/install/install_test.go | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/cmd/pkg/install.go b/cmd/pkg/install.go index 5417e8c..f4abb07 100644 --- a/cmd/pkg/install.go +++ b/cmd/pkg/install.go @@ -24,11 +24,11 @@ If no arguments are used, the command installs all the packages specified in the If one or more output folders are specified, the command installs only the packages whose OutputFolder matches the specified folders. (OutputFolder is a field in the package manifest file.) -Set the environment variable BASE_URL to specify where package templates are downloaded from. +Set the environment variable ` + install.BaseUrlEnvName + ` to specify where package templates are downloaded from. `, Example: `ok pkg install networking ok pkg install networking my-app -BASE_URL=../boilerplate/terraform ok install networking my-app +` + install.BaseUrlEnvName + `=../boilerplate/terraform ok pkg install networking my-app `, SilenceErrors: true, RunE: func(cmd *cobra.Command, outputFolders []string) error { diff --git a/pkg/pkg/install/install.go b/pkg/pkg/install/install.go index a3fa953..ee3a18e 100644 --- a/pkg/pkg/install/install.go +++ b/pkg/pkg/install/install.go @@ -10,11 +10,12 @@ import ( "strings" ) +const BaseUrlEnvName = "OK_BASE_URL" const DefaultBaseUrl = "git@github.com:oslokommune/golden-path-boilerplate.git//" const DefaultPackagePathPrefix = "boilerplate/terraform" func Run(pkgManifestFilename string, outputFolders []string) error { - baseUrlOrPath := os.Getenv("BASE_URL") + baseUrlOrPath := os.Getenv(BaseUrlEnvName) cmds, err := CreateBoilerplateCommands(pkgManifestFilename, outputFolders, baseUrlOrPath) if err != nil { diff --git a/pkg/pkg/install/install_test.go b/pkg/pkg/install/install_test.go index 359ef9b..f9003f7 100644 --- a/pkg/pkg/install/install_test.go +++ b/pkg/pkg/install/install_test.go @@ -42,7 +42,7 @@ func TestInstall(t *testing.T) { }, }, { - testName: "Should support URL in BASE_URL", + testName: "Should support URL in OK_BASE_URL", packageManifestFilename: "package.yml", baseUrl: "git@github.com:oslokommune/SOMETHING_ELSE.git//", expectBoilerplateCommands: []*exec.Cmd{ @@ -56,7 +56,7 @@ func TestInstall(t *testing.T) { ), }, }, { - testName: "Should support file path in BASE_URL", + testName: "Should support file path in OK_BASE_URL", packageManifestFilename: "package.yml", baseUrl: "..", expectBoilerplateCommands: []*exec.Cmd{