mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
Improve SDK, quickstart, token, features docs
This commit is contained in:
@@ -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
|
||||
|
||||

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

|
||||
|
||||
### 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>
|
||||
|
||||
Reference in New Issue
Block a user