mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-04 21:26:17 +00:00
Merge pull request #2588 from Infisical/daniel/cli-eu-region
feat: cloud EU region support
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
import path from "node:path";
|
import path from "node:path";
|
||||||
|
|
||||||
import { TableName, TSecretFolders, TSecretsV2 } from "@app/db/schemas";
|
import { TableName, TSecretFolders, TSecretsV2 } from "@app/db/schemas";
|
||||||
import { ForbiddenRequestError } from "@app/lib/errors";
|
import { ForbiddenRequestError, NotFoundError } from "@app/lib/errors";
|
||||||
import { groupBy } from "@app/lib/fn";
|
import { groupBy } from "@app/lib/fn";
|
||||||
import { logger } from "@app/lib/logger";
|
import { logger } from "@app/lib/logger";
|
||||||
|
|
||||||
@@ -342,7 +342,7 @@ export const recursivelyGetSecretPaths = async ({
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (!env) {
|
if (!env) {
|
||||||
throw new Error(`'${environment}' environment not found in project with ID ${projectId}`);
|
throw new NotFoundError({ message: `'${environment}' environment not found in project with ID ${projectId}` });
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fetch all folders in env once with a single query
|
// Fetch all folders in env once with a single query
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ export const recursivelyGetSecretPaths = ({
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (!env) {
|
if (!env) {
|
||||||
throw new Error(`'${environment}' environment not found in project with ID ${projectId}`);
|
throw new NotFoundError({ message: `'${environment}' environment not found in project with ID ${projectId}` });
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fetch all folders in env once with a single query
|
// Fetch all folders in env once with a single query
|
||||||
|
|||||||
+18
-10
@@ -216,7 +216,9 @@ var loginCmd = &cobra.Command{
|
|||||||
}
|
}
|
||||||
//override domain
|
//override domain
|
||||||
domainQuery := true
|
domainQuery := true
|
||||||
if config.INFISICAL_URL_MANUAL_OVERRIDE != "" && config.INFISICAL_URL_MANUAL_OVERRIDE != util.INFISICAL_DEFAULT_API_URL {
|
if config.INFISICAL_URL_MANUAL_OVERRIDE != "" &&
|
||||||
|
config.INFISICAL_URL_MANUAL_OVERRIDE != fmt.Sprintf("%s/api", util.INFISICAL_DEFAULT_EU_URL) &&
|
||||||
|
config.INFISICAL_URL_MANUAL_OVERRIDE != fmt.Sprintf("%s/api", util.INFISICAL_DEFAULT_US_URL) {
|
||||||
overrideDomain, err := DomainOverridePrompt()
|
overrideDomain, err := DomainOverridePrompt()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
util.HandleError(err)
|
util.HandleError(err)
|
||||||
@@ -526,16 +528,17 @@ func askForDomain() error {
|
|||||||
|
|
||||||
// query user to choose between Infisical cloud or self hosting
|
// query user to choose between Infisical cloud or self hosting
|
||||||
const (
|
const (
|
||||||
INFISICAL_CLOUD = "Infisical Cloud"
|
INFISICAL_CLOUD_US = "Infisical Cloud (US Region)"
|
||||||
SELF_HOSTING = "Self Hosting"
|
INFISICAL_CLOUD_EU = "Infisical Cloud (EU Region)"
|
||||||
ADD_NEW_DOMAIN = "Add a new domain"
|
SELF_HOSTING = "Self Hosting"
|
||||||
|
ADD_NEW_DOMAIN = "Add a new domain"
|
||||||
)
|
)
|
||||||
|
|
||||||
options := []string{INFISICAL_CLOUD, SELF_HOSTING}
|
options := []string{INFISICAL_CLOUD_US, INFISICAL_CLOUD_EU, SELF_HOSTING}
|
||||||
optionsPrompt := promptui.Select{
|
optionsPrompt := promptui.Select{
|
||||||
Label: "Select your hosting option",
|
Label: "Select your hosting option",
|
||||||
Items: options,
|
Items: options,
|
||||||
Size: 2,
|
Size: 3,
|
||||||
}
|
}
|
||||||
|
|
||||||
_, selectedHostingOption, err := optionsPrompt.Run()
|
_, selectedHostingOption, err := optionsPrompt.Run()
|
||||||
@@ -543,10 +546,15 @@ func askForDomain() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if selectedHostingOption == INFISICAL_CLOUD {
|
if selectedHostingOption == INFISICAL_CLOUD_US {
|
||||||
//cloud option
|
// US cloud option
|
||||||
config.INFISICAL_URL = fmt.Sprintf("%s/api", util.INFISICAL_DEFAULT_URL)
|
config.INFISICAL_URL = fmt.Sprintf("%s/api", util.INFISICAL_DEFAULT_US_URL)
|
||||||
config.INFISICAL_LOGIN_URL = fmt.Sprintf("%s/login", util.INFISICAL_DEFAULT_URL)
|
config.INFISICAL_LOGIN_URL = fmt.Sprintf("%s/login", util.INFISICAL_DEFAULT_US_URL)
|
||||||
|
return nil
|
||||||
|
} else if selectedHostingOption == INFISICAL_CLOUD_EU {
|
||||||
|
// EU cloud option
|
||||||
|
config.INFISICAL_URL = fmt.Sprintf("%s/api", util.INFISICAL_DEFAULT_EU_URL)
|
||||||
|
config.INFISICAL_LOGIN_URL = fmt.Sprintf("%s/login", util.INFISICAL_DEFAULT_EU_URL)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ func init() {
|
|||||||
cobra.OnInitialize(initLog)
|
cobra.OnInitialize(initLog)
|
||||||
rootCmd.PersistentFlags().StringP("log-level", "l", "info", "log level (trace, debug, info, warn, error, fatal)")
|
rootCmd.PersistentFlags().StringP("log-level", "l", "info", "log level (trace, debug, info, warn, error, fatal)")
|
||||||
rootCmd.PersistentFlags().Bool("telemetry", true, "Infisical collects non-sensitive telemetry data to enhance features and improve user experience. Participation is voluntary")
|
rootCmd.PersistentFlags().Bool("telemetry", true, "Infisical collects non-sensitive telemetry data to enhance features and improve user experience. Participation is voluntary")
|
||||||
rootCmd.PersistentFlags().StringVar(&config.INFISICAL_URL, "domain", util.INFISICAL_DEFAULT_API_URL, "Point the CLI to your own backend [can also set via environment variable name: INFISICAL_API_URL]")
|
rootCmd.PersistentFlags().StringVar(&config.INFISICAL_URL, "domain", fmt.Sprintf("%s/api", util.INFISICAL_DEFAULT_US_URL), "Point the CLI to your own backend [can also set via environment variable name: INFISICAL_API_URL]")
|
||||||
rootCmd.PersistentFlags().Bool("silent", false, "Disable output of tip/info messages. Useful when running in scripts or CI/CD pipelines.")
|
rootCmd.PersistentFlags().Bool("silent", false, "Disable output of tip/info messages. Useful when running in scripts or CI/CD pipelines.")
|
||||||
rootCmd.PersistentPreRun = func(cmd *cobra.Command, args []string) {
|
rootCmd.PersistentPreRun = func(cmd *cobra.Command, args []string) {
|
||||||
silent, err := cmd.Flags().GetBool("silent")
|
silent, err := cmd.Flags().GetBool("silent")
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package cmd
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
"fmt"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
|
||||||
"github.com/Infisical/infisical-merge/packages/config"
|
"github.com/Infisical/infisical-merge/packages/config"
|
||||||
@@ -119,7 +120,7 @@ var domainCmd = &cobra.Command{
|
|||||||
|
|
||||||
domain := ""
|
domain := ""
|
||||||
domainQuery := true
|
domainQuery := true
|
||||||
if config.INFISICAL_URL_MANUAL_OVERRIDE != util.INFISICAL_DEFAULT_API_URL {
|
if config.INFISICAL_URL_MANUAL_OVERRIDE != fmt.Sprintf("%s/api", util.INFISICAL_DEFAULT_EU_URL) && config.INFISICAL_URL_MANUAL_OVERRIDE != fmt.Sprintf("%s/api", util.INFISICAL_DEFAULT_US_URL) {
|
||||||
|
|
||||||
override, err := DomainOverridePrompt()
|
override, err := DomainOverridePrompt()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ package util
|
|||||||
const (
|
const (
|
||||||
CONFIG_FILE_NAME = "infisical-config.json"
|
CONFIG_FILE_NAME = "infisical-config.json"
|
||||||
CONFIG_FOLDER_NAME = ".infisical"
|
CONFIG_FOLDER_NAME = ".infisical"
|
||||||
INFISICAL_DEFAULT_API_URL = "https://app.infisical.com/api"
|
INFISICAL_DEFAULT_US_URL = "https://app.infisical.com"
|
||||||
INFISICAL_DEFAULT_URL = "https://app.infisical.com"
|
INFISICAL_DEFAULT_EU_URL = "https://eu.infisical.com"
|
||||||
INFISICAL_WORKSPACE_CONFIG_FILE_NAME = ".infisical.json"
|
INFISICAL_WORKSPACE_CONFIG_FILE_NAME = ".infisical.json"
|
||||||
INFISICAL_TOKEN_NAME = "INFISICAL_TOKEN"
|
INFISICAL_TOKEN_NAME = "INFISICAL_TOKEN"
|
||||||
INFISICAL_UNIVERSAL_AUTH_ACCESS_TOKEN_NAME = "INFISICAL_UNIVERSAL_AUTH_ACCESS_TOKEN"
|
INFISICAL_UNIVERSAL_AUTH_ACCESS_TOKEN_NAME = "INFISICAL_UNIVERSAL_AUTH_ACCESS_TOKEN"
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/Infisical/infisical-merge/packages/api"
|
"github.com/Infisical/infisical-merge/packages/api"
|
||||||
|
"github.com/Infisical/infisical-merge/packages/config"
|
||||||
"github.com/Infisical/infisical-merge/packages/models"
|
"github.com/Infisical/infisical-merge/packages/models"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -11,7 +12,7 @@ func GetOrganizationsNameList(organizationResponse api.GetOrganizationsResponse)
|
|||||||
organizations := organizationResponse.Organizations
|
organizations := organizationResponse.Organizations
|
||||||
|
|
||||||
if len(organizations) == 0 {
|
if len(organizations) == 0 {
|
||||||
message := fmt.Sprintf("You don't have any organization created in Infisical. You must first create a organization at %s", INFISICAL_DEFAULT_URL)
|
message := fmt.Sprintf("You don't have any organization created in Infisical. You must first create a organization at %s", config.INFISICAL_URL)
|
||||||
PrintErrorMessageAndExit(message)
|
PrintErrorMessageAndExit(message)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,7 +38,7 @@ func GetWorkspacesInOrganization(workspaceResponse api.GetWorkSpacesResponse, or
|
|||||||
}
|
}
|
||||||
|
|
||||||
if len(filteredWorkspaces) == 0 {
|
if len(filteredWorkspaces) == 0 {
|
||||||
message := fmt.Sprintf("You don't have any projects created in Infisical organization. You must first create a project at %s", INFISICAL_DEFAULT_URL)
|
message := fmt.Sprintf("You don't have any projects created in Infisical organization. You must first create a project at %s", config.INFISICAL_URL)
|
||||||
PrintErrorMessageAndExit(message)
|
PrintErrorMessageAndExit(message)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user