Skip to content

Commit

Permalink
Improve SDK, quickstart, token, features docs
Browse files Browse the repository at this point in the history
  • Loading branch information
dangtony98 committed Mar 16, 2023
1 parent bb2bcb8 commit 3ac98ba
Show file tree
Hide file tree
Showing 13 changed files with 150 additions and 66 deletions.
5 changes: 3 additions & 2 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ services:
env_file: .env
environment:
- NODE_ENV=development
- MONGO_URL=mongodb://root:example@mongo:27017/?authSource=admin
networks:
- infisical-dev

Expand Down Expand Up @@ -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:
Expand Down
19 changes: 7 additions & 12 deletions docs/getting-started/dashboard/token.mdx
Original file line number Diff line number Diff line change
@@ -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.

To generate the the token, head over to your project settings as shown below.
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>

28 changes: 7 additions & 21 deletions docs/getting-started/features.mdx
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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).
16 changes: 13 additions & 3 deletions docs/getting-started/introduction.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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>
112 changes: 90 additions & 22 deletions docs/getting-started/quickstart.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

<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.

### Set up the CLI

1. Follow the instructions to [install our platform-agnostic CLI](/cli/overview).

2. Initialize Infisical for your project.

```bash
# move to your project
cd /path/to/project

# initialize infisical
infisical init
```

### Start your app with 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

1. Follow the instructions to [install the CLI](/cli/overview).
```js
const express = require("express");
const port = 3000;
const infisical = require("infisical-node");
2. Initialize Infisical for your project.
const main = async () => {
await infisical.connect({
token: "st.xxx.xxx",
});
```bash
# move to your project
cd /path/to/project
// your application logic
# initialize infisical
infisical init
```
app.get("/", (req, res) => {
res.send(`Howdy, ${infisical.get("NAME")}!`);
});
## Start your app with environment variables injected
app.listen(port, async () => {
console.log(`App listening on port ${port}`);
});
};
```
```bash
# inject environment variables into app
infisical run -- [your application start command]
```
<Warning>
We do not recommend hardcoding your [Infisical
Token](/getting-started/dashboard/token). Setting it as an environment
variable would be best.
<Info>
Check out our [integrations](/integrations/overview) for injecting environment
variables into frameworks and platforms like Docker.
</Info>
</Warning>
Check out our [SDKs](/sdks/overview) for other language SDKs.
Your app should be running with the environment variables injected.
</Tab>
</Tabs>
18 changes: 12 additions & 6 deletions docs/mint.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
},
{
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
18 changes: 18 additions & 0 deletions docs/sdks/overview.mdx
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit 3ac98ba

Please sign in to comment.