docs/cli/commands/run.mdx
# Example
infisical run [options] -- npm run dev
```
# Example
infisical run [options] --command "npm run bootstrap && npm run dev start; other-bash-command"
```
Inject secrets from Infisical into your application process.
$ infisical run -- <your application command>
# Example
$ infisical run -- npm run dev
```bash
# Example
export INFISICAL_TOKEN=$(infisical login --method=universal-auth --client-id=<identity-client-id> --client-secret=<identity-client-secret> --silent --plain) # --plain flag will output only the token, so it can be fed to an environment variable. --silent will disable any update messages.
```
<Info>
Alternatively, you may use service tokens.
```bash
# Example
export INFISICAL_TOKEN=<service-token>
```
</Info>
To use, simply export this variable in the terminal before running this command.
```bash
# Example
export INFISICAL_DISABLE_UPDATE_CHECK=true
```
```bash
# Example
infisical run --watch -- printenv
```
```bash
# Example
infisical run --project-config-dir=/some-dir -- printenv
```
```bash
# Example
infisical run --command="npm run build && npm run dev; more-commands..."
```
```bash
# Example
infisical run --projectId=<project-id> -- npm run dev
```
```bash
# Example
infisical run --token="<universal-auth-access-token>" --projectId=<project-id> -- npm run start
```
You may also expose the token to the CLI by setting the environment variable `INFISICAL_TOKEN` before executing the run command. This will have the same effect as setting the token with `--token` flag
Default value: `true`
Default value: `true`
{" "}
<Accordion title="--env"> This is used to specify the environment from which secrets should be retrieved. The accepted values are the environment slugs defined for your project, such as `dev`, `staging`, `test`, and `prod`. Default value: `dev` </Accordion> <Accordion title="--secret-overriding"> Prioritizes personal secrets with the same name over shared secretsDefault value: `true`
```bash
# Example
infisical run --tags=tag1,tag2,tag3 -- npm run dev
```
Note: you must reference the tag by its slug name not its fully qualified name. Go to project settings to view all tag slugs.
By default, all secrets are fetched
```bash
# Example
infisical run --path="/nextjs" -- npm run dev
```
To automatically reload your command when secrets change, use the --watch flag.
infisical run --watch -- npm run dev
This will watch for changes in your secrets and automatically restart your command with the new secrets. When your command restarts, it will have the new environment variables injeceted into it.
<Note> Please note that this feature is intended for development purposes. It is not recommended to use this in production environments. Generally it's not recommended to automatically reload your application in production when remote changes are made. </Note>