1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00

docs: clarify node sdk instructions wrt envs and tokens (#2799)

## What

This change does two things:

It **removes the `environment` option** from the initialization
examples. This option is deprecated and only causes confusion. There's
no good reason to have it lying around in the examples.

It also **updates the explanation of the code samples**, telling you
that you need to generate an API key and linking you to the reference
doc and how to guide.

Relates to: #2782.
This commit is contained in:
Thomas Heartman 2023-01-03 11:26:17 +01:00 committed by GitHub
parent bae623d69e
commit 983d3a9513
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -37,7 +37,6 @@ const unleash = require('unleash-client');
unleash.initialize({
url: 'https://YOUR-API-URL',
appName: 'my-node-name',
environment: process.env.APP_ENV,
customHeaders: { Authorization: 'SOME-SECRET' },
});
```
@ -51,7 +50,6 @@ const { startUnleash } = require('unleash-client');
const unleash = await startUnleash({
url: 'https://YOUR-API-URL',
appName: 'my-node-name',
environment: process.env.APP_ENV,
customHeaders: { Authorization: 'SOME-SECRET' },
});
```
@ -59,7 +57,7 @@ const unleash = await startUnleash({
</TabItem>
</Tabs>
The example code above will initialize the client SDK, and connect to the Unleash-hosted demo instance. It also uses the API token for the demo instance. You should change the URL and the Authorization header (API token) with the correct values for your instance, which you may locate under “Instance admin” in the menu.
The example code above will initialize the client SDK, and try to the Unleash instance you point it to. You will need to use your own Unleash instance URL and a [server-side API token](../api-tokens-and-client-keys.mdx#client-tokens) to connect. For steps on how to create an API token, refer to the [_how to create API tokens_](../../how-to/how-to-create-api-tokens.mdx) guide.
## Step 3: Use the feature toggle {#step-3-use-the-feature-toggle}