This commit is contained in:
Vladyslav Matsiiako
2023-01-05 23:15:26 -08:00
8 changed files with 42 additions and 18 deletions
+1 -1
View File
@@ -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.1.16", Version: "0.2.0",
} }
// 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.
+1 -1
View File
@@ -313,7 +313,7 @@ func init() {
secretsCmd.AddCommand(secretsGetCmd) secretsCmd.AddCommand(secretsGetCmd)
secretsCmd.AddCommand(secretsSetCmd) secretsCmd.AddCommand(secretsSetCmd)
secretsCmd.AddCommand(secretsDeleteCmd) secretsCmd.AddCommand(secretsDeleteCmd)
secretsCmd.PersistentFlags().String("env", "dev", "Used to define the environment name on which actions should be taken on") secretsCmd.PersistentFlags().String("env", "dev", "Used to select the environment name on which actions should be taken on")
secretsCmd.Flags().Bool("expand", true, "Parse shell parameter expansions in your secrets") secretsCmd.Flags().Bool("expand", true, "Parse shell parameter expansions in your secrets")
secretsCmd.PersistentPreRun = func(cmd *cobra.Command, args []string) { secretsCmd.PersistentPreRun = func(cmd *cobra.Command, args []string) {
util.RequireLogin() util.RequireLogin()
+1 -1
View File
@@ -46,7 +46,7 @@ func GetPlainTextSecretsViaServiceToken(fullServiceToken string) ([]models.Singl
return nil, fmt.Errorf("unable to decode symmetric encryption details [err=%v]", err) return nil, fmt.Errorf("unable to decode symmetric encryption details [err=%v]", err)
} }
plainTextWorkspaceKey, err := crypto.DecryptSymmetric(decodedSymmetricEncryptionDetails.Key, decodedSymmetricEncryptionDetails.Cipher, decodedSymmetricEncryptionDetails.Tag, decodedSymmetricEncryptionDetails.IV) plainTextWorkspaceKey, err := crypto.DecryptSymmetric([]byte(serviceTokenParts[3]), decodedSymmetricEncryptionDetails.Cipher, decodedSymmetricEncryptionDetails.Tag, decodedSymmetricEncryptionDetails.IV)
if err != nil { if err != nil {
return nil, fmt.Errorf("unable to decrypt the required workspace key") return nil, fmt.Errorf("unable to decrypt the required workspace key")
} }
+3 -1
View File
@@ -53,14 +53,16 @@ func GetKeyRing() (keyring.Keyring, error) {
} }
func fileKeyringPassphrasePrompt(prompt string) (string, error) { func fileKeyringPassphrasePrompt(prompt string) (string, error) {
fmt.Println("You may set the `INFISICAL_VAULT_FILE_PASSPHRASE` environment variable to avoid typing password")
if password, ok := os.LookupEnv("INFISICAL_VAULT_FILE_PASSPHRASE"); ok { if password, ok := os.LookupEnv("INFISICAL_VAULT_FILE_PASSPHRASE"); ok {
return password, nil return password, nil
} }
fmt.Fprintf(os.Stderr, "%s: ", prompt) fmt.Fprintf(os.Stderr, "%s:", prompt)
b, err := term.ReadPassword(int(os.Stdin.Fd())) b, err := term.ReadPassword(int(os.Stdin.Fd()))
if err != nil { if err != nil {
return "", err return "", err
} }
fmt.Println("")
return string(b), nil return string(b), nil
} }
-1
View File
@@ -31,7 +31,6 @@ Inject environment variables from the platform into an application process.
| 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` | Used to link a local project to the platform (required only if injecting via the service token method) | 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` |
| `--command` | Pass secrets into chained commands (e.g., `"first-command && second-command; more-commands..."`) | None | | `--command` | Pass secrets into chained commands (e.g., `"first-command && second-command; more-commands..."`) | None |
| `--secret-overriding`| Prioritizes personal secrets with the same name over shared secrets | `true` | | `--secret-overriding`| Prioritizes personal secrets with the same name over shared secrets | `true` |
+22 -4
View File
@@ -10,7 +10,7 @@ infisical secrets
This command enables you to perform CRUD (create, read, update, delete) operations on secrets within your Infisical project. With it, you can view, create, update, and delete secrets in your environment. This command enables you to perform CRUD (create, read, update, delete) operations on secrets within your Infisical project. With it, you can view, create, update, and delete secrets in your environment.
### Sub-commands ### Sub-commands
<Accordion title="infisical secrets"> <Accordion title="infisical secrets" defaultOpen="true">
Use this command to print out all of the secrets in your project Use this command to print out all of the secrets in your project
``` ```
@@ -33,6 +33,12 @@ This command enables you to perform CRUD (create, read, update, delete) operatio
Default value: `true` Default value: `true`
</Accordion> </Accordion>
<Accordion title="--env">
Used to select the environment name on which actions should be taken on
Default value: `dev`
</Accordion>
</Accordion> </Accordion>
<Accordion title="infisical secrets get"> <Accordion title="infisical secrets get">
@@ -52,7 +58,11 @@ This command enables you to perform CRUD (create, read, update, delete) operatio
``` ```
### Flags ### Flags
None <Accordion title="--env">
Used to select the environment name on which actions should be taken on
Default value: `dev`
</Accordion>
</Accordion> </Accordion>
<Accordion title="infisical secrets set"> <Accordion title="infisical secrets set">
@@ -74,7 +84,11 @@ $ infisical secrets set STRIPE_API_KEY=sjdgwkeudyjwe DOMAIN=example.com HASH=jeb
``` ```
### Flags ### Flags
None <Accordion title="--env">
Used to select the environment name on which actions should be taken on
Default value: `dev`
</Accordion>
</Accordion> </Accordion>
<Accordion title="infisical secrets delete"> <Accordion title="infisical secrets delete">
@@ -89,5 +103,9 @@ $ infisical secrets set STRIPE_API_KEY=sjdgwkeudyjwe DOMAIN=example.com HASH=jeb
``` ```
### Flags ### Flags
None <Accordion title="--env">
Used to select the environment name on which actions should be taken on
Default value: `dev`
</Accordion>
</Accordion> </Accordion>
+13 -8
View File
@@ -5,14 +5,19 @@ import posthog from 'posthog-js';
import { ENV, POSTHOG_API_KEY, POSTHOG_HOST } from '../utilities/config'; import { ENV, POSTHOG_API_KEY, POSTHOG_HOST } from '../utilities/config';
export const initPostHog = () => { export const initPostHog = () => {
if (typeof window !== 'undefined') { try {
// @ts-ignore if (typeof window !== 'undefined') {
if (ENV == 'production' && TELEMETRY_CAPTURING_ENABLED) { // @ts-ignore
posthog.init(POSTHOG_API_KEY, { if (ENV == 'production' && TELEMETRY_CAPTURING_ENABLED) {
api_host: POSTHOG_HOST console.log("Outside of posthog", "POSTHOG_API_KEY", POSTHOG_API_KEY, "POSTHOG_HOST", POSTHOG_HOST)
}); posthog.init(POSTHOG_API_KEY, {
api_host: POSTHOG_HOST
});
}
} }
}
return posthog; return posthog;
} catch (e) {
console.log("posthog err", e)
}
}; };
+1 -1
View File
@@ -2,7 +2,7 @@
scripts/replace-variable.sh "$BAKED_NEXT_PUBLIC_POSTHOG_API_KEY" "$NEXT_PUBLIC_POSTHOG_API_KEY" scripts/replace-variable.sh "$BAKED_NEXT_PUBLIC_POSTHOG_API_KEY" "$NEXT_PUBLIC_POSTHOG_API_KEY"
if [ "$INFISICAL_TELEMETRY_ENABLED" != "false" ]; then if [ "$TELEMETRY_ENABLED" != "false" ]; then
echo "Telemetry is enabled" echo "Telemetry is enabled"
scripts/set-telemetry.sh true scripts/set-telemetry.sh true
else else