Improve SDK, quickstart, token, features docs

This commit is contained in:
Tuan Dang
2023-03-16 15:47:24 +07:00
parent bb2bcb8bd1
commit 3ac98ba326
13 changed files with 150 additions and 66 deletions

View File

@@ -34,6 +34,7 @@ services:
env_file: .env
environment:
- NODE_ENV=development
- MONGO_URL=mongodb://root:example@mongo:27017/?authSource=admin
networks:
- infisical-dev
@@ -65,8 +66,8 @@ services:
restart: always
env_file: .env
environment:
- MONGO_INITDB_ROOT_USERNAME=${MONGO_USERNAME}
- MONGO_INITDB_ROOT_PASSWORD=${MONGO_PASSWORD}
- MONGO_INITDB_ROOT_USERNAME=root
- MONGO_INITDB_ROOT_PASSWORD=example
volumes:
- mongo-data:/data/db
networks:

View File

@@ -1,26 +1,21 @@
---
title: "Infisical Token"
description: "Use Infisical service token as one of the authentication methods."
description: "Use the Infisical Token as one of the authentication methods."
---
An Infisical Token is needed to authenticate the CLI when there isn't an easy way to input your login credentials.
An Infisical Token is useful for:
It's useful for your CI/CD environments and integrations such as [Docker](/integrations/platforms/docker) and [Docker Compose](/integrations/platforms/docker-compose).
- Authenticating the [Infisical CLI](/cli/overview) when there isn't an easy way to input your login credentials.
- Granting the [Infisical SDKs](/sdks/overview) access to secrets scoped to a project and environment.
It's also useful for CI/CD environments and integrations such as [Docker](/integrations/platforms/docker) and [Docker Compose](/integrations/platforms/docker-compose).
To generate the the token, head over to your project settings as shown below.
![token add](../../images/project-token-add.png)
## Feeding Infisical Token to the CLI
The Infisical CLI checks for the presence of an environment variable called `INFISICAL_TOKEN`.
The Infisical CLI checks for the presence of an environment variable called `INFISICAL_TOKEN`.
If it detects this variable in the terminal where it is being run, it will use it to authenticate and retrieve the environment variables that the token is authorized to access.
This allows you to use the CLI in environments where you are unable to run the `infisical login` command.
<Note>
The token grants read-only access to a particular environment and project for
a specified amount of time. Once the token is expired, the CLI using it will no longer be able to make
requests with it.
</Note>

View File

@@ -1,10 +1,8 @@
---
title: "Features"
description: "A list of features that Infisical has to offer."
description: "A non-exhaustive list of features that Infisical has to offer."
---
This is a non-exhaustive list of features that Infisical offers:
## Platform
- Provision members access to organizations and projects.
@@ -16,29 +14,17 @@ This is a non-exhaustive list of features that Infisical offers:
## CLI
The CLI is used to inject environment variables into applications and infrastructure.
The [CLI](/cli/overview) is used to inject environment variables into applications and infrastructure.
- Inject environment variables.
- Inject environment variables into containers via service tokens for Docker.
## SDKs
[SDKs](/sdks/overview) enable apps to fetch back secrets using an [Infisical Token](/getting-started/dashboard/token) scoped to a project and environment.
## Roadmap
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 |
| ------------------------------------- | ----------- |
| Account recovery: Backup key | Done |
| 2FA | Done |
| Read/write access controls | Done |
| Comparing secrets across environments | Done |
| Integrations | Ongoing |
| More hosting options | Ongoing |
| 1-Click Deploys | Ongoing |
| Access logs | Ongoing |
| Account recovery: Member-assisted | Coming soon |
| Slack & MS teams integrations | Coming soon |
| Version control for secrets | Coming soon |
| Restricted IPs | Coming soon |
| Secret rotation | Coming soon |
We're building the future of secret management, one that's comprehensive and accessible to all. Check out our [roadmap](https://www.notion.so/infisical/be2d2585a6694e40889b03aef96ea36b?v=5b19a8127d1a4060b54769567a8785fa).
Interested in contributing? Check out the [guide](/contributing/overview).

View File

@@ -19,6 +19,9 @@ Start syncing environment variables with [Infisical Cloud](https://app.infisical
<Card href="/cli/overview" title="CLI" icon="square-terminal" color="#16a34a">
Install the CLI to inject secrets into apps and infra.
</Card>
<Card href="/sdks/overview" title="SDKs" icon="puzzle-piece" color="#16a34a">
Install an SDK into your app to fetch secrets.
</Card>
<Card
href="/self-hosting/overview"
title="Self-hosting"
@@ -37,7 +40,14 @@ Start syncing environment variables with [Infisical Cloud](https://app.infisical
</Card>
</CardGroup>
<Card title="Set up a 1x1 with an Infisical Engineer" iconType="duotone" color="#ca8b04" href="https://calendly.com/maidull/30min">
Our team is happy to help you get started with Infisical. If you have any questions or want to learn how you can leverage Infisical within your infrastructure, **[set up a 1-on-1 with an Infisical engineer](https://cal.com/maidul/15min)**.
<Card
title="Set up a 1x1 with an Infisical Engineer"
iconType="duotone"
color="#ca8b04"
href="https://calendly.com/maidull/30min"
>
Our team is happy to help you get started with Infisical. If you have any
questions or want to learn how you can leverage Infisical within your
infrastructure, **[set up a 1-on-1 with an Infisical
engineer](https://cal.com/maidul/15min)**.
</Card>

View File

@@ -3,9 +3,7 @@ title: "Quickstart"
description: "Start managing your developer secrets and configs with Infisical in 10 minutes."
---
This example demonstrates how to store and inject environment variables from [Infisical Cloud](https://app.infisical.com) into your application.
Note that the Infisical CLI is platform-agnostic and can inject environment variables across many tech stacks and frameworks.
These examples demonstrate how to store and fetch environment variables from [Infisical Cloud](https://app.infisical.com) into your application.
## Set up Infisical Cloud
@@ -15,30 +13,100 @@ Note that the Infisical CLI is platform-agnostic and can inject environment vari
![project quickstart](../images/project-quickstart.png)
## Set up the CLI
## Fetch Secrets for Your App
1. Follow the instructions to [install the CLI](/cli/overview).
<Tabs>
<Tab title="CLI">
The Infisical CLI is platform-agnostic and enables you to inject environment variables into your app across many tech stacks and frameworks.
2. Initialize Infisical for your project.
### Set up the CLI
```bash
# move to your project
cd /path/to/project
1. Follow the instructions to [install our platform-agnostic CLI](/cli/overview).
# initialize infisical
infisical init
```
2. Initialize Infisical for your project.
## Start your app with environment variables injected
```bash
# move to your project
cd /path/to/project
```bash
# inject environment variables into app
infisical run -- [your application start command]
```
# initialize infisical
infisical init
```
<Info>
Check out our [integrations](/integrations/overview) for injecting environment
variables into frameworks and platforms like Docker.
</Info>
### Start your app with environment variables injected
Your app should be running with the environment variables injected.
```bash
# inject environment variables into app
infisical run -- [your application start command]
```
Your app should now be running with the environment variables injected.
Check out our [integrations](/integrations/overview) for injecting environment variables into frameworks and platforms like Docker.
</Tab>
<Tab title="SDK">
[Infisical SDKs](/sdks/overview) let your app fetch back secrets using an [Infisical Token](/getting-started/dashboard/token) that is scoped to a project and environment in Infisical. In this example, we demonstrate how to use the [Node SDK](/sdks/languages/node).
### Obtain an [Infisical Token](/getting-started/dashboard/token)
Head to your project settings to create a token scoped to the project and environment you wish to fetch secrets from.
![token add](../images/project-token-add.png)
### Install the SDK
```bash
npm install infisical-node --save
```
### Initialize the Infisical client
```js
await infisical.connect({
token: "your_infisical_token",
});
```
### Get a value
```js
const value = infisical.get("SOME_KEY");
```
### Example with Express
```js
const express = require("express");
const port = 3000;
const infisical = require("infisical-node");
const main = async () => {
await infisical.connect({
token: "st.xxx.xxx",
});
// your application logic
app.get("/", (req, res) => {
res.send(`Howdy, ${infisical.get("NAME")}!`);
});
app.listen(port, async () => {
console.log(`App listening on port ${port}`);
});
};
```
<Warning>
We do not recommend hardcoding your [Infisical
Token](/getting-started/dashboard/token). Setting it as an environment
variable would be best.
</Warning>
Check out our [SDKs](/sdks/overview) for other language SDKs.
</Tab>
</Tabs>

View File

@@ -191,15 +191,21 @@
"self-hosting/configuration/email"
]
},
{
"group": "Overview",
"pages": [
"sdks/overview"
]
},
{
"group": "SDKs",
"pages": [
"sdks/overview/node",
"sdks/overview/python",
"sdks/overview/java",
"sdks/overview/ruby",
"sdks/overview/go",
"sdks/overview/rust"
"sdks/languages/node",
"sdks/languages/python",
"sdks/languages/java",
"sdks/languages/ruby",
"sdks/languages/go",
"sdks/languages/rust"
]
},
{

18
docs/sdks/overview.mdx Normal file
View File

@@ -0,0 +1,18 @@
---
title: "Overview"
description: "How to use Infisical SDKs to fetch back secrets for your app"
---
Infisical SDKs provide the easiest way for your app to fetch back secrets using an [Infisical Token](/getting-started/dashboard/token) and has a few benefits:
- Local development: Replace 10s of environment variables in your `.env` file with 1 environment variable (the [Infisical Token](/getting-started/dashboard/token)).
- Production: Fetch secrets back to any cloud regardless of if an integration exists between Infisical and the cloud platform.
We currently only have the [Node SDK](/sdks/languages/node) available but more language SDKs are coming out soon:
- [Node](/sdks/languages/node)
- [Python](/sdks/languages/python)
- [Java](/sdks/languages/java)
- [Ruby](/sdks/languages/ruby)
- [Go](/sdks/languages/go)
- [Rust](/sdks/languages/rust)