Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
vmatsiiako committed Jan 6, 2023
2 parents d90affb + 7152e16 commit 9386efd
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 18 deletions.
2 changes: 1 addition & 1 deletion cli/packages/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ var rootCmd = &cobra.Command{
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.`,
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.
Expand Down
2 changes: 1 addition & 1 deletion cli/packages/cmd/secrets.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ func init() {
secretsCmd.AddCommand(secretsGetCmd)
secretsCmd.AddCommand(secretsSetCmd)
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.PersistentPreRun = func(cmd *cobra.Command, args []string) {
util.RequireLogin()
Expand Down
2 changes: 1 addition & 1 deletion cli/packages/util/secrets.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func GetPlainTextSecretsViaServiceToken(fullServiceToken string) ([]models.Singl
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 {
return nil, fmt.Errorf("unable to decrypt the required workspace key")
}
Expand Down
4 changes: 3 additions & 1 deletion cli/packages/util/vault.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,16 @@ func GetKeyRing() (keyring.Keyring, 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 {
return password, nil
}

fmt.Fprintf(os.Stderr, "%s: ", prompt)
fmt.Fprintf(os.Stderr, "%s:", prompt)
b, err := term.ReadPassword(int(os.Stdin.Fd()))
if err != nil {
return "", err
}
fmt.Println("")
return string(b), nil
}
1 change: 0 additions & 1 deletion docs/cli/commands/run.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ Inject environment variables from the platform into an application process.
| Option | Description | Default value |
| -------------- | ----------------------------------------------------------------------------------------------------------- | ------------- |
| `--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` |
| `--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` |
26 changes: 22 additions & 4 deletions docs/cli/commands/secrets.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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.

### 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

```
Expand All @@ -33,6 +33,12 @@ This command enables you to perform CRUD (create, read, update, delete) operatio
Default value: `true`
</Accordion>

<Accordion title="--env">
Used to select the environment name on which actions should be taken on

Default value: `dev`
</Accordion>

</Accordion>

<Accordion title="infisical secrets get">
Expand All @@ -52,7 +58,11 @@ This command enables you to perform CRUD (create, read, update, delete) operatio
```

### Flags
None
<Accordion title="--env">
Used to select the environment name on which actions should be taken on

Default value: `dev`
</Accordion>
</Accordion>

<Accordion title="infisical secrets set">
Expand All @@ -74,7 +84,11 @@ $ infisical secrets set STRIPE_API_KEY=sjdgwkeudyjwe DOMAIN=example.com HASH=jeb
```

### Flags
None
<Accordion title="--env">
Used to select the environment name on which actions should be taken on

Default value: `dev`
</Accordion>
</Accordion>

<Accordion title="infisical secrets delete">
Expand All @@ -89,5 +103,9 @@ $ infisical secrets set STRIPE_API_KEY=sjdgwkeudyjwe DOMAIN=example.com HASH=jeb
```

### Flags
None
<Accordion title="--env">
Used to select the environment name on which actions should be taken on

Default value: `dev`
</Accordion>
</Accordion>
21 changes: 13 additions & 8 deletions frontend/components/analytics/posthog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,19 @@ import posthog from 'posthog-js';
import { ENV, POSTHOG_API_KEY, POSTHOG_HOST } from '../utilities/config';

export const initPostHog = () => {
if (typeof window !== 'undefined') {
// @ts-ignore
if (ENV == 'production' && TELEMETRY_CAPTURING_ENABLED) {
posthog.init(POSTHOG_API_KEY, {
api_host: POSTHOG_HOST
});
try {
if (typeof window !== 'undefined') {
// @ts-ignore
if (ENV == 'production' && TELEMETRY_CAPTURING_ENABLED) {
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)
}
};
2 changes: 1 addition & 1 deletion frontend/scripts/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

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"
scripts/set-telemetry.sh true
else
Expand Down

0 comments on commit 9386efd

Please sign in to comment.