Skip to content

Commit

Permalink
feat(cli): jb binary environment variable (#272)
Browse files Browse the repository at this point in the history
Adds and environment variable TANKA_JB_PATH, to provide the location of the jb executable on the system. If unset, Tanka will search $PATH, as it did before.
  • Loading branch information
qckzr authored May 6, 2020
1 parent 6941b87 commit 4b6bf31
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cmd/tk/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,12 @@ func initCmd() *cli.Command {
}

func installK8sLib() error {
if _, err := exec.LookPath("jb"); err != nil {
jbBinary := "jb"
if env := os.Getenv("TANKA_JB_PATH"); env != "" {
jbBinary = env
}

if _, err := exec.LookPath(jbBinary); err != nil {
return errors.New("jsonnet-bundler not found in $PATH. Follow https://tanka.dev/install#jsonnet-bundler for installation instructions")
}

Expand Down
5 changes: 5 additions & 0 deletions docs/docs/env-vars.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ route: "/env-vars"

# Environment Variables

### TANKA_JB_PATH

**Description**: Path to the `jb` tool executable
**Default**: `$PATH/jb`

### TANKA_KUBECTL_PATH

**Description**: Path to the `kubectl` tool executable
Expand Down

0 comments on commit 4b6bf31

Please sign in to comment.