mirror of
https://github.com/directus/directus.git
synced 2026-04-25 03:00:53 -04:00
* Allow to specify ADMIN_TOKEN in ENV (#22059) * Add changeset --------- Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
This commit is contained in:
7
.changeset/silly-ladybugs-carry.md
Normal file
7
.changeset/silly-ladybugs-carry.md
Normal file
@@ -0,0 +1,7 @@
|
||||
---
|
||||
'@directus/env': minor
|
||||
'docs': minor
|
||||
'@directus/api': minor
|
||||
---
|
||||
|
||||
Added support for the ADMIN_TOKEN environment variable
|
||||
@@ -102,5 +102,7 @@ async function createDefaultAdmin(schema: SchemaOverview) {
|
||||
logger.info(`No admin password provided. Defaulting to "${adminPassword}"`);
|
||||
}
|
||||
|
||||
await usersService.createOne({ email: adminEmail, password: adminPassword, role, ...defaultAdminUser });
|
||||
const token = env['ADMIN_TOKEN'] ?? null;
|
||||
|
||||
await usersService.createOne({ email: adminEmail, password: adminPassword, token, role, ...defaultAdminUser });
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ which will create the database (file) for you.
|
||||
::: tip Admin Account
|
||||
|
||||
Adding the `ADMIN_EMAIL` & `ADMIN_PASSWORD` to the `.env` file before running the `bootstrap` command, will populate the
|
||||
admin user with the provided credentials instead of random values.
|
||||
admin user with the provided credentials instead of random values. `ADMIN_TOKEN` sets the API token for the admin user.
|
||||
|
||||
:::
|
||||
|
||||
|
||||
@@ -42,9 +42,9 @@ Kubernetes configuration.
|
||||
|
||||
::: tip First User
|
||||
|
||||
You can use the `ADMIN_EMAIL` and `ADMIN_PASSWORD` environment variables to automatically provision the first user on
|
||||
first creation using the `bootstrap` command. See [Environment Variables](/self-hosted/config-options#general) for more
|
||||
information.
|
||||
You can use the `ADMIN_EMAIL`, `ADMIN_PASSWORD` and `ADMIN_TOKEN` environment variables to automatically provision the
|
||||
first user on first creation using the `bootstrap` command. See
|
||||
[Environment Variables](/self-hosted/config-options#general) for more information.
|
||||
|
||||
:::
|
||||
|
||||
|
||||
@@ -1043,6 +1043,7 @@ variables to automatically configure the first user:
|
||||
| ---------------- | ------------------------------------------------------------------------------------------------- | ------------- |
|
||||
| `ADMIN_EMAIL` | The email address of the first user that's automatically created when using `directus bootstrap`. | -- |
|
||||
| `ADMIN_PASSWORD` | The password of the first user that's automatically created when using `directus bootstrap`. | -- |
|
||||
| `ADMIN_TOKEN` | The API token of the first user that's automatically created when using `directus bootstrap`. | -- |
|
||||
|
||||
## Telemetry
|
||||
|
||||
|
||||
@@ -220,6 +220,7 @@ export const DIRECTUS_VARIABLES = [
|
||||
// admin account
|
||||
'ADMIN_EMAIL',
|
||||
'ADMIN_PASSWORD',
|
||||
'ADMIN_TOKEN',
|
||||
|
||||
// telemetry
|
||||
'TELEMETRY',
|
||||
|
||||
Reference in New Issue
Block a user