diff --git a/docs/getting-started/cli/cli-guide.mdx b/docs/getting-started/cli/cli-guide.mdx index db4a43b22..0f3ad9635 100644 --- a/docs/getting-started/cli/cli-guide.mdx +++ b/docs/getting-started/cli/cli-guide.mdx @@ -1,31 +1,54 @@ --- -title: "Infisical CLI" -description: "Learn about each supported command and its flags" +title: "Usage" --- -## Background +## Login -Infisical ships with multiple commands to assist with ongoing project needs; we list these commands and give context for them below. +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. - - If you haven't already, install the Infisical CLI - +```bash +infisical login +``` -Note on arguments: +## Initialization -- [environment]: the intended environment for the given command being one of dev, staging, or prod. -- [projectId]: the project identifier found on the dashboard. +In the root of your local project, initialize Infisical and follow steps to connect your project to the platform. -## Commands +```bash +cd /path/to/project -- `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` +# initialization +infisical init +``` -### Global flags -These are flags you can add to any command +## Injecting environment variables -- `--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 ` \ No newline at end of file +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 +``` diff --git a/docs/getting-started/cli/infisical-token.mdx b/docs/getting-started/cli/infisical-token.mdx deleted file mode 100644 index eeee4b76b..000000000 --- a/docs/getting-started/cli/infisical-token.mdx +++ /dev/null @@ -1,68 +0,0 @@ ---- -title: "Infisical Token" -description: "Learn to authenticate via the CLI without in manually" ---- - -## Background - -To authenticate the Infisical CLI in environments other than your local desktop environment, you will have to utilize the Infisical Token. -The Infisical Token is a quick and easy way to authenticate the CLI without having to type in your email and password. This is especially needed -in production environments where you cannot type in your login details. - -With the Infisical Token, you can allow read only access to a particular environment (dev, prod, etc.) for a given project for a set amount of time. Once the token expires, any CLI application -that relies on it for authentication will be denied access to retrieve the related secrets. - -## Generate a Infisical Token -To get started, navigate to your dashboard and select the project for which you would like to generate a Infisical Token for. -Then head over to project settings and you should see a similar page like below. - -![title](./images/project_settings_page.png) - -To add a new Infisical Token, press the `add new token` button. This will bring up a page like below. - -![title](./images/add_new_token.png) - -Enter a name to help you identify the token then choose the environment from which you would like the CLI to retrieve the secrets from. Lastly, choose a duration -for the token. - - -Once the token is expired, the CLI using it will no longer be able to make requests with it. - - - -## Use Infisical token with CLI -Once you have generated a token, it is easy to tell the Infisical CLI to use it. - -### Feeding the token to the CLI -The CLI looks out for an environment variable called `INFISICAL_TOKEN`. Setting this environment variable depends on where you run the CLI. -For example, if you are running the CLI in a Docker container, you may set the environment variable via the docker run command like so. - -Docker run example: -``` - docker run --env INFISICAL_TOKEN=... -``` - - -In the event your token is exposed, visit the project settings page again and deactivate the token to expire it immediately. - - -### Prepare `infisical run` command - -Once you have exposed the `INFISICAL_TOKEN` environment variable to the environment the CLI is running in you can prepare the run command. -To have the CLI authenticate via the Infisical Token, you must provide values for flags `--stage` and `--projectId` - -Example: -``` -infisical run --stage=prod --projectId= -``` - - - Notice that we do not need to run any other command such as `infisical init` or `infisical login` when we use the Infisical Token. - - - -To learn more about the commands and it's flags [visit](/CLI) - -### Support - -Lastly, if you have any questions or inquiries, shoot an email over to [support@infisical.com](mailto:support@infisical.com) 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. diff --git a/docs/getting-started/cli/installation.mdx b/docs/getting-started/cli/installation.mdx index 71d57790c..ef83d72a6 100644 --- a/docs/getting-started/cli/installation.mdx +++ b/docs/getting-started/cli/installation.mdx @@ -2,6 +2,8 @@ title: "Installation" --- +Prerequisite: Setup an account with Infisical Cloud or via self-hosted installation. + Follow the guide for your OS below to install the CLI. @@ -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 + ``` - -## 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 -``` - - - To authenticate without logging in manually, read about [Infisical - Token](/infisicalToken) - -#### 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 -- -``` - -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 [support@infisical.com](mailto:support@infisical.com) 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. diff --git a/docs/getting-started/cli/reference.mdx b/docs/getting-started/cli/reference.mdx new file mode 100644 index 000000000..c0bc557cd --- /dev/null +++ b/docs/getting-started/cli/reference.mdx @@ -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` | diff --git a/docs/getting-started/cli/token.mdx b/docs/getting-started/cli/token.mdx new file mode 100644 index 000000000..043f07431 --- /dev/null +++ b/docs/getting-started/cli/token.mdx @@ -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) + + + Once the token is expired, the CLI using it will no longer be able to make + requests with it. + diff --git a/docs/getting-started/dashboard/create-account.mdx b/docs/getting-started/dashboard/create-account.mdx index 1ac0e82fa..45cb62c06 100644 --- a/docs/getting-started/dashboard/create-account.mdx +++ b/docs/getting-started/dashboard/create-account.mdx @@ -1,5 +1,5 @@ --- -title: "New Account" +title: "Sign up" --- ## Self-hosted @@ -8,11 +8,11 @@ If you're using a self-hosted installation, follow the [setup](/self-hosting/ove ## Infisical Cloud -**Step 1.** Open [infisical.com](https://infisical.com/) and click on either "Try Infisical for free" or "Start for free" to head to the signup sequence. +**Step 1:** Open [infisical.com](https://infisical.com/) and click on either "Try Infisical for free" or "Start for free" to head to the signup sequence. ![title](../../images/landing-page.png) -**Step 2.** Fill out the signup sequence. +**Step 2:** Fill out the signup sequence. After verifying your email address, you'll be prompted to fill out some required fields to set up your account. diff --git a/docs/getting-started/dashboard/integrations.mdx b/docs/getting-started/dashboard/integrations.mdx new file mode 100644 index 000000000..2a4791af4 --- /dev/null +++ b/docs/getting-started/dashboard/integrations.mdx @@ -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 diff --git a/docs/getting-started/dashboard/token.mdx b/docs/getting-started/dashboard/token.mdx new file mode 100644 index 000000000..615af160c --- /dev/null +++ b/docs/getting-started/dashboard/token.mdx @@ -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/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). diff --git a/docs/getting-started/features.mdx b/docs/getting-started/features.mdx index 92b4d237f..9c77c225b 100644 --- a/docs/getting-started/features.mdx +++ b/docs/getting-started/features.mdx @@ -46,18 +46,20 @@ Missing an integration? Throw in a request. We're building the future of secret management, one that's comprehensive and accessible to all. Some high-level features we have in mind: -| Feature | Status | -| ------------------------------------- | --------------- | -| Integrations | Ongoing | -| More hosting options | Ongoing | -| 1-Click Deploys | Ongoing | -| Slack & MS teams integrations | Not yet started | -| Access logs | Not yet started | -| Version control for secrets | Not yet started | -| 2FA | Not yet started | -| Restricted IPs | Not yet started | -| Read/write access controls | Not yet started | -| Secret rotation | Not yet started | -| Comparing secrets across environments | Not yet started | +| Feature | Status | +| ------------------------------------- | ---------------- | +| Integrations | Ongoing | +| More hosting options | Ongoing | +| 1-Click Deploys | Ongoing | +| Account recovery: Backup key | Ongoing | +| Account recovery: Member-assisted | Noet yet started | +| Slack & MS teams integrations | Not yet started | +| Access logs | Not yet started | +| Version control for secrets | Not yet started | +| 2FA | Not yet started | +| Restricted IPs | Not yet started | +| Read/write access controls | Not yet started | +| Secret rotation | Not yet started | +| Comparing secrets across environments | Not yet started | Interested in contributing? Check out the guide. diff --git a/docs/images/project-integrations.png b/docs/images/project-integrations.png new file mode 100644 index 000000000..90f50a8c4 Binary files /dev/null and b/docs/images/project-integrations.png differ diff --git a/docs/images/project-token-add.png b/docs/images/project-token-add.png new file mode 100644 index 000000000..cd17b3027 Binary files /dev/null and b/docs/images/project-token-add.png differ diff --git a/docs/images/project-token-added.png b/docs/images/project-token-added.png new file mode 100644 index 000000000..302a86280 Binary files /dev/null and b/docs/images/project-token-added.png differ diff --git a/docs/images/project-token-name.png b/docs/images/project-token-name.png new file mode 100644 index 000000000..662fbb0f7 Binary files /dev/null and b/docs/images/project-token-name.png differ diff --git a/docs/mint.json b/docs/mint.json index e879b4092..f916ba757 100644 --- a/docs/mint.json +++ b/docs/mint.json @@ -49,14 +49,20 @@ "pages": [ "getting-started/dashboard/create-account", "getting-started/dashboard/organization", - "getting-started/dashboard/project" + "getting-started/dashboard/project", + "getting-started/dashboard/integrations", + "getting-started/dashboard/token" ] }, { "group": "Command Line", - "pages": ["getting-started/cli/installation", "getting-started/cli/cli-guide", "getting-started/cli/infisical-token"] - }, - "getting-started/infiscial-token" + "pages": [ + "getting-started/cli/installation", + "getting-started/cli/cli-guide", + "getting-started/cli/token", + "getting-started/cli/reference" + ] + } ] }, {