mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-05 12:26:38 +00:00
Merge branch 'main' of https://github.com/Infisical/infisical
This commit is contained in:
@@ -129,4 +129,10 @@ jobs:
|
|||||||
- name: Download helm values to file and upgrade gamma deploy
|
- name: Download helm values to file and upgrade gamma deploy
|
||||||
run: |
|
run: |
|
||||||
wget https://raw.githubusercontent.com/Infisical/infisical/main/.github/values.yaml
|
wget https://raw.githubusercontent.com/Infisical/infisical/main/.github/values.yaml
|
||||||
helm upgrade infisical infisical-helm-charts/infisical --values values.yaml --recreate-pods
|
helm upgrade infisical infisical-helm-charts/infisical --values values.yaml --recreate-pods
|
||||||
|
if [[ $(helm status infisical) == *"FAILED"* ]]; then
|
||||||
|
echo "Helm upgrade failed"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo "Helm upgrade was successful"
|
||||||
|
fi
|
||||||
@@ -16,10 +16,11 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
FormatDotenv string = "dotenv"
|
FormatDotenv string = "dotenv"
|
||||||
FormatJson string = "json"
|
FormatJson string = "json"
|
||||||
FormatCSV string = "csv"
|
FormatCSV string = "csv"
|
||||||
FormatYaml string = "yaml"
|
FormatYaml string = "yaml"
|
||||||
|
FormatDotEnvExport string = "dotenv-export"
|
||||||
)
|
)
|
||||||
|
|
||||||
// exportCmd represents the export command
|
// exportCmd represents the export command
|
||||||
@@ -85,6 +86,8 @@ func formatEnvs(envs []models.SingleEnvironmentVariable, format string) (string,
|
|||||||
switch strings.ToLower(format) {
|
switch strings.ToLower(format) {
|
||||||
case FormatDotenv:
|
case FormatDotenv:
|
||||||
return formatAsDotEnv(envs), nil
|
return formatAsDotEnv(envs), nil
|
||||||
|
case FormatDotEnvExport:
|
||||||
|
return formatAsDotEnvExport(envs), nil
|
||||||
case FormatJson:
|
case FormatJson:
|
||||||
return formatAsJson(envs), nil
|
return formatAsJson(envs), nil
|
||||||
case FormatCSV:
|
case FormatCSV:
|
||||||
@@ -92,7 +95,7 @@ func formatEnvs(envs []models.SingleEnvironmentVariable, format string) (string,
|
|||||||
case FormatYaml:
|
case FormatYaml:
|
||||||
return formatAsYaml(envs), nil
|
return formatAsYaml(envs), nil
|
||||||
default:
|
default:
|
||||||
return "", fmt.Errorf("invalid format type: %s. Available format types are [%s]", format, []string{FormatDotenv, FormatJson, FormatCSV, FormatYaml})
|
return "", fmt.Errorf("invalid format type: %s. Available format types are [%s]", format, []string{FormatDotenv, FormatJson, FormatCSV, FormatYaml, FormatDotEnvExport})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -117,6 +120,15 @@ func formatAsDotEnv(envs []models.SingleEnvironmentVariable) string {
|
|||||||
return dotenv
|
return dotenv
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Format environment variables as a dotenv file with export at the beginning
|
||||||
|
func formatAsDotEnvExport(envs []models.SingleEnvironmentVariable) string {
|
||||||
|
var dotenv string
|
||||||
|
for _, env := range envs {
|
||||||
|
dotenv += fmt.Sprintf("export %s='%s'\n", env.Key, env.Value)
|
||||||
|
}
|
||||||
|
return dotenv
|
||||||
|
}
|
||||||
|
|
||||||
func formatAsYaml(envs []models.SingleEnvironmentVariable) string {
|
func formatAsYaml(envs []models.SingleEnvironmentVariable) string {
|
||||||
var dotenv string
|
var dotenv string
|
||||||
for _, env := range envs {
|
for _, env := range envs {
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ var rootCmd = &cobra.Command{
|
|||||||
Short: "Infisical CLI is used to inject environment variables into any process",
|
Short: "Infisical CLI is used to inject environment variables into any process",
|
||||||
Long: `Infisical is a simple, end-to-end encrypted service that enables teams to sync and manage their environment variables across their development life cycle.`,
|
Long: `Infisical is a simple, end-to-end encrypted service that enables teams to sync and manage their environment variables across their development life cycle.`,
|
||||||
CompletionOptions: cobra.CompletionOptions{HiddenDefaultCmd: true},
|
CompletionOptions: cobra.CompletionOptions{HiddenDefaultCmd: true},
|
||||||
Version: "0.2.1",
|
Version: "0.2.2",
|
||||||
}
|
}
|
||||||
|
|
||||||
// Execute adds all child commands to the root command and sets flags appropriately.
|
// Execute adds all child commands to the root command and sets flags appropriately.
|
||||||
|
|||||||
@@ -12,12 +12,12 @@ Export environment variables from the platform into a file format.
|
|||||||
|
|
||||||
## Options
|
## Options
|
||||||
|
|
||||||
| Option | Description | Default value |
|
| Option | Description | Default value |
|
||||||
| ------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | ------------- |
|
| ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------- |
|
||||||
| `--env` | Used to set the environment that secrets are pulled from. Accepted values: `dev`, `staging`, `test`, `prod` | `dev` |
|
| `--env` | Used to set the environment that secrets are pulled from. Accepted values: `dev`, `staging`, `test`, `prod` | `dev` |
|
||||||
| `--projectId` | Only required if injecting via the [service token method](../token). If you are not using service token, the project id will be automatically retrieved from the `.infisical.json` located at the root of your local project. | `None` |
|
| `--projectId` | Only required if injecting via the [service token method](../token). If you are not using service token, the project id will be automatically retrieved from the `.infisical.json` located at the root of your local project. | `None` |
|
||||||
| `--expand` | Parse shell parameter expansions in your secrets (e.g., `${DOMAIN}`) | `true` |
|
| `--expand` | Parse shell parameter expansions in your secrets (e.g., `${DOMAIN}`) | `true` |
|
||||||
| `--format` | Format of the output file. Accepted values: `dotenv`, `csv` and `json` | `dotenv` |
|
| `--format` | Format of the output file. Accepted values: `dotenv`, `dotenv-export`, `csv` and `json` | `dotenv` |
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
@@ -25,6 +25,9 @@ Export environment variables from the platform into a file format.
|
|||||||
# Export variables to a .env file
|
# Export variables to a .env file
|
||||||
infisical export > .env
|
infisical export > .env
|
||||||
|
|
||||||
|
# Export variables to a .env file (with export keyword)
|
||||||
|
infisical export --format=dotenv-export > .env
|
||||||
|
|
||||||
# Export variables to a CSV file
|
# Export variables to a CSV file
|
||||||
infisical export --format=csv > secrets.csv
|
infisical export --format=csv > secrets.csv
|
||||||
|
|
||||||
@@ -33,4 +36,5 @@ infisical export --format=json > secrets.json
|
|||||||
|
|
||||||
# Export variables to a YAML file
|
# Export variables to a YAML file
|
||||||
infisical export --format=yaml > secrets.yaml
|
infisical export --format=yaml > secrets.yaml
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user