Files
infisical/docs/cli/usage.mdx
Maidul Islam 7f51aaf451 Add vault docs
2022-12-25 00:04:52 -05:00

64 lines
1.9 KiB
Plaintext

---
title: "Usage"
---
Prerequisite: [Install the CLI](/cli/overview)
## Authenticate
<Tabs>
<Tab title="Local development">
To use the Infisical CLI in your development environment, you can run the command below.
This will allow you to access the features and functionality provided by the CLI.
```bash
infisical login
```
</Tab>
<Tab title="Infisical Token">
To use Infisical CLI in environments where you cannot run the `infisical login` command, you can authenticate via a
Infisical Token instead. Learn more about [Infisical Token](../getting-started/dashboard/token).
</Tab>
</Tabs>
## Initialize Infisical for your project
```bash
# navigate to your project
cd /path/to/project
# initialize infisical
infisical init
```
## Inject environment variables
```bash
# inject environment variables into app
infisical run -- [your application start command]
```
Options you can specify:
| 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` |
## Examples:
```bash
# example with node
infisical run -- node index.js
# example with node (nodemon)
infisical run -- nodemon index.js
# example with node (nodemon) pulling in secrets from test environment
infisical run --env=test -- nodemon index.js
# example with flask
infisical run -- flask run
```