-
Notifications
You must be signed in to change notification settings - Fork 988
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
328 additions
and
216 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,56 @@ | ||
--- | ||
title: "Infisical CLI" | ||
description: "Learn about each supported command and its flags" | ||
title: "Usage" | ||
--- | ||
|
||
## Background | ||
Prerequisite: [Install the CLI](../../getting-started/cli/installation) | ||
|
||
Infisical ships with multiple commands to assist with ongoing project needs; we list these commands and give context for them below. | ||
## Login | ||
|
||
<Card title="Install the CLI" icon="lightbulb" href="/installCLI"> | ||
If you haven't already, install the Infisical CLI | ||
</Card> | ||
Login in using the `login` command in your terminal. Logging in is a one-time, post-installation action that authenticates you with the platform — to change users, you can run the command again. | ||
|
||
Note on arguments: | ||
```bash | ||
infisical login | ||
``` | ||
|
||
- [environment]: the intended environment for the given command being one of dev, staging, or prod. | ||
- [projectId]: the project identifier found on the dashboard. | ||
## Initialization | ||
|
||
## Commands | ||
In the root of your local project, initialize Infisical and follow steps to connect your project to the platform. | ||
|
||
- `login` used to set the logged in user. Your credentials are saved securely in your system key ring. Note: only one user can be logged in at a time. To change the logged in user, run the command again and overwrite the previous login. | ||
- `init` used to link your infisical.com project to your local project. Run this command ideally at the root of your local project. You will have to run this command for each new project you create locally. | ||
- `run` used to inject your secrets as environment variables into your application process. Example `infisical run --stage=prod -- npm run start` | ||
- `---projectId` flag is used to link your local project to a Infisical.com project. Use this option only when you are injecting via Infisical Token instead of your login. | ||
- `---stage` flag is used to set the environment from which your secrets are pulled from. By default, secrets from your project are pulled from the `dev`. To change to for example prod, add `--stage=prod` | ||
```bash | ||
cd /path/to/project | ||
|
||
### Global flags | ||
These are flags you can add to any command | ||
# initialization | ||
infisical init | ||
``` | ||
|
||
- `--domain` you may change this if you are self hosting Infisical. By default, the CLI points to Infisical.com backend. To point to your own backend, make sure to set this flag for each command you run. Example `infisical login --domain=https://mybackend.com` | ||
- `--debug` use this flag when you want to see more logs related to the error you are receiving. By default debug logs are hidden. Example `infisical run --debug <your command>` | ||
## Injecting environment variables | ||
|
||
To inject environment variables from the platform to your project, use the `run` command. | ||
|
||
```bash | ||
# command | ||
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` | | ||
|
||
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 | ||
``` |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,8 @@ | |
title: "Installation" | ||
--- | ||
|
||
Prerequisite: [Setup an account](../../getting-started/dashboard/create-account) with Infisical Cloud or via self-hosted installation. | ||
|
||
Follow the guide for your OS below to install the CLI. | ||
|
||
<Tabs> | ||
|
@@ -84,64 +86,10 @@ Follow the guide for your OS below to install the CLI. | |
| sudo -E bash | ||
``` | ||
|
||
Then install CLI | ||
``` | ||
$ apt-get update && apt-get install -y infisical | ||
``` | ||
Then install CLI | ||
```bash | ||
$ apt-get update && apt-get install -y infisical | ||
``` | ||
|
||
</Tab> | ||
</Tabs> | ||
|
||
## Usage | ||
|
||
Once you have the CLI installed in your system, follow the guide to login and sync your first project. | ||
|
||
#### Login | ||
|
||
Login to the CLI by running the following command in your terminal | ||
|
||
``` | ||
infisical login | ||
``` | ||
<Info> | ||
To authenticate without logging in manually, read about [Infisical | ||
Token](/infisicalToken) | ||
</Info> | ||
#### Link secrets to your project After logging in, `CD` into the root of your local | ||
project. Then run the following command in the terminal to link your Infisical project | ||
to your local project. | ||
``` | ||
infisical init | ||
``` | ||
#### Inject | ||
To inject the secrets from the Infisical project you have selected in step 2 into your application process, run the following command. | ||
``` | ||
infisical run -- <your application start command> | ||
``` | ||
Example: | ||
``` | ||
infisical run -- npm run dev | ||
``` | ||
By default, Infisical injects secrets from your development environment. To modify from which environment your secrets are pulled from, use the --stage flag | ||
Example: | ||
``` | ||
infisical run --stage=prod -- npm run dev | ||
``` | ||
You're now automatically pulling and injecting secrets as environment variables into your application! | ||
### Support | ||
We're constantly improving Infisical, so we'd love to get your feedback and take feature requests. | ||
Lastly, if you have any questions or inquiries, shoot an email over to [[email protected]](mailto:[email protected]) so we can assist you. Alternatively, feel free to post your question or DM us on Slack here; we'd be happy to connect with you. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
--- | ||
title: "Reference" | ||
--- | ||
|
||
## Commands | ||
|
||
| Command | Description | Options | | ||
| ------- | -------------------------------------------------------------------- | ---------------------- | | ||
| `login` | Used to authenticate and set the logged in user. | | ||
| `init` | Used to link a local project to the platform. | | ||
| `run` | Used to inject envars from the platform into an application process. | `--projectId`, `--env` | | ||
|
||
## Global options | ||
|
||
| Option | Description | | ||
| ----------------- | ---------------------------------- | | ||
| `--help`, `-h` | List help for any command | | ||
| `--debug`, `-d` | Enable verbose logging | | ||
| `--domain` | Use to direct Infisical to | | ||
| `--version`, `-v` | Print version information and quit | | ||
|
||
### Login | ||
|
||
Used to authenticate and set the logged in user. | ||
|
||
Post-authentication credentials are saved securely in your system keyring. Since only one user can be logged in at a time, to change the logged in user, run the command again to overwrite the previous login. | ||
|
||
```bash | ||
infisical login | ||
``` | ||
|
||
### Init | ||
|
||
Used to link a local project to the platform (cloud or self-hosted) | ||
|
||
Run this command at the root of your local project. You will have to run this command for each new project you create locally. | ||
|
||
```bash | ||
infisical init | ||
``` | ||
|
||
### Run | ||
|
||
Used to inject environment variables from the platform into an application process. | ||
|
||
```bash | ||
infisical run [options] -- [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` | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--- | ||
title: "Infisical Token" | ||
--- | ||
|
||
Prerequisite: [Infisical Token and How to Generate One](../../getting-started/dashboard/token). | ||
|
||
It's possible to use the CLI to sync environment varialbes without manually entering login credentials by using a service token in the prerequisite link above. | ||
|
||
## Feeding Infisical Token to the CLI | ||
|
||
The CLI looks out for an environment variable called the `INFISICAL_TOKEN` which you can set depending on where you run the CLI. If `INFISICAL_TOKEN` is detected by the CLI, it will authenticate and retrieve the environment variables which the token is authorized for. | ||
|
||
A common use-case is to use the Infisical Token to fetch environment variables with Docker. More specifically, a token can be passed to a container as an environment variable for the CLI to authenticate and pull its corresponding secrets. Check out the integration guides for that: | ||
|
||
- [Docker](../../integrations/docker) | ||
- [Docker Compose](../../integrations/docker-compose) | ||
|
||
<Info> | ||
Once the token is expired, the CLI using it will no longer be able to make | ||
requests with it. | ||
</Info> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
title: "Integrations" | ||
--- | ||
|
||
We’re still early with integrations but you’ll be able to sync environment variables across your entire infrastructure from local development to CI/CD and production. | ||
|
||
![integrations](../../images/project-integrations.png) | ||
|
||
Check out integrations: | ||
|
||
- Heroku | ||
- Docker | ||
- Docker Compose |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
--- | ||
title: "Infisical Token" | ||
--- | ||
|
||
An Infisical Token is needed to authenticate the CLI when there isn't an easy way to manually type in your login credentials to sync environment variables to your applications. | ||
|
||
It grants read-only access to a particular environment and project for a specified amount of time; once the token expires, any CLI application that relies on it for authentication will be denied access to retrieve related secrets. | ||
|
||
This is useful in the following contexts: | ||
|
||
- [Docker](../../integrations/docker)/[Docker-Compose](../../integrations/docker-compose) integration: An Infisical Token can be passed to a Docker container as an environment variable for the CLI to authenticate and pull its corresponding secrets. | ||
|
||
## Generate an Infisical Token | ||
|
||
It's possible to generate an Infisical token in the settings of a project. | ||
|
||
![token add](../../images/project-token-add.png) | ||
|
||
![token name](../../images/project-token-name.png) | ||
|
||
![token added](../../images/project-token-added.png) | ||
|
||
To use the Infisical Token in the CLI, check out the docs for that [here](../../getting-started/cli/token). |
Oops, something went wrong.