Skip to content

Commit

Permalink
Allow INFISCAL_URL to use domain for self-hosted
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashley Hutson committed Jan 21, 2023
1 parent 68b7e6e commit 3c28246
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
14 changes: 12 additions & 2 deletions cli/packages/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ package cmd
import (
"os"

"github.com/Infisical/infisical-merge/packages/config"
"github.com/spf13/cobra"

"github.com/Infisical/infisical-merge/packages/config"
"github.com/Infisical/infisical-merge/packages/util"
)

var rootCmd = &cobra.Command{
Expand All @@ -30,7 +32,15 @@ func Execute() {
func init() {
rootCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
rootCmd.PersistentFlags().BoolVarP(&debugLogging, "debug", "d", false, "Enable verbose logging")
rootCmd.PersistentFlags().StringVar(&config.INFISICAL_URL, "domain", "https://app.infisical.com/api", "Point the CLI to your own backend")
rootCmd.PersistentFlags().StringVar(&config.INFISICAL_URL, "domain", util.INFISICAL_DEFAULT_URL, "Point the CLI to your own backend [ENV: INFISICAL_URL]")
// rootCmd.PersistentPreRun = func(cmd *cobra.Command, args []string) {
// }

// if config.INFISICAL_URL is set to the default value, check if INFISICAL_URL is set in the environment
// this is used to allow overrides of the default value
if config.INFISICAL_URL == util.INFISICAL_DEFAULT_URL {
if envInfisicalURL, ok := os.LookupEnv("INFISICAL_URL"); ok {
config.INFISICAL_URL = envInfisicalURL
}
}
}
1 change: 1 addition & 0 deletions cli/packages/util/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package util
const (
CONFIG_FILE_NAME = "infisical-config.json"
CONFIG_FOLDER_NAME = ".infisical"
INFISICAL_DEFAULT_URL = "https://app.infisical.com/api"
INFISICAL_WORKSPACE_CONFIG_FILE_NAME = ".infisical.json"
INFISICAL_TOKEN_NAME = "INFISICAL_TOKEN"
SECRET_TYPE_PERSONAL = "personal"
Expand Down

0 comments on commit 3c28246

Please sign in to comment.