Merge branch 'main' into aggregation
|
Before Width: | Height: | Size: 64 KiB After Width: | Height: | Size: 64 KiB |
|
Before Width: | Height: | Size: 59 KiB After Width: | Height: | Size: 59 KiB |
|
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 44 KiB |
|
Before Width: | Height: | Size: 43 KiB After Width: | Height: | Size: 43 KiB |
|
Before Width: | Height: | Size: 58 KiB After Width: | Height: | Size: 58 KiB |
|
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 33 KiB |
BIN
docs/assets/guides/installation/plesk-screenshot.png
Normal file
|
After Width: | Height: | Size: 54 KiB |
@@ -28,10 +28,10 @@ support most [SQL database vendors](/guides/installation/cli/#_1-confirm-minimum
|
||||
|
||||
## Database Abstraction
|
||||
|
||||
Directus supports mirroring all the most SQL databases. There are many different SQL database vendors, including popular
|
||||
choices such as MySQL, PostgreSQL, and SQLite. Each vendor has subtle (and sometimes not so subtle) differences in how
|
||||
they function, so Directus includes an abstraction layer that helps it avoid writing different code for each different
|
||||
type.
|
||||
Directus supports mirroring all the most widely used SQL databases. There are many different SQL database vendors,
|
||||
including popular choices such as MySQL, PostgreSQL, and SQLite. Each vendor has subtle (and sometimes not so subtle)
|
||||
differences in how they function, so Directus includes an abstraction layer that helps it avoid writing different code
|
||||
for each different type.
|
||||
|
||||
This means there is the possiblility of supporting other datastores in the future, such as NoSQL options like MongoDB,
|
||||
or even third-party data services like Firebase or Heroku. However these options are _fundamentally_ different from the
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
## Monorepo
|
||||
|
||||
The primary Directus repository is located at [`directus/directus`](https://github.com/directus/directus) and houses the
|
||||
Admin App (Vue.js 2 w/ Composition API), API (Node.js), project documentation (Markdown), API Specification (OpenAPI),
|
||||
Admin App (Vue.js 3 w/ Composition API), API (Node.js), project documentation (Markdown), API Specification (OpenAPI),
|
||||
and other smaller packages used internally. Directus follows a monorepo design similar to React or Babel — this page
|
||||
will outline our monorepo's design and structure.
|
||||
|
||||
@@ -54,7 +54,7 @@ Utility functions
|
||||
|
||||
## `/app`
|
||||
|
||||
Contains the Directus Admin App, written in Vue.js 2 w/ the Composition API.
|
||||
Contains the Directus Admin App, written in Vue.js 3 w/ the Composition API.
|
||||
|
||||
## `/app/public`
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ While Directus is always completely free, you will likely need to pay for these
|
||||
- [Internet Information Services (IIS)](/guides/installation/iis)
|
||||
- [Amazon AWS](/guides/installation/aws)
|
||||
- [DigitalOcean App Platform](/guides/installation/digitalocean-app-platform)
|
||||
- [Shared Hosting with Plesk](/guides/installation/plesk)
|
||||
|
||||
## One-Click Installs
|
||||
|
||||
|
||||
@@ -166,3 +166,8 @@ improve Directus in your language, you can [learn more here](/contributing/trans
|
||||
|
||||
Coming in 2021, the [Directus Marketplace](https://directus.market/) will offer a unified portal to extensions created
|
||||
by our Core Team and community contributors.
|
||||
|
||||
### Awesome List
|
||||
|
||||
Head to [awesome-directus](https://github.com/directus-community/awesome-directus) for a list of awesome things related
|
||||
to Directus.
|
||||
|
||||
@@ -9,7 +9,7 @@ Custom endpoints are dynamically loaded from within your project's `/extensions/
|
||||
extensions directory is configurable within your env file, and may be located elsewhere.
|
||||
|
||||
Each endpoint is registered using a registration function within a scoped directory. For example, to create a custom
|
||||
`/custom/my-endpoint/` endpoint, you would add the following function to `/extensions/endpoints/my-endpoint/index.js`.
|
||||
`/my-endpoint/` endpoint, you would add the following function to `/extensions/endpoints/my-endpoint/index.js`.
|
||||
|
||||
```js
|
||||
module.exports = function registerEndpoint(router) {
|
||||
@@ -20,9 +20,9 @@ module.exports = function registerEndpoint(router) {
|
||||
You can also create several scoped endpoints within a single function:
|
||||
|
||||
```js
|
||||
// /custom/my-endpoint/
|
||||
// /custom/my-endpoint/intro
|
||||
// /custom/my-endpoint/goodbye
|
||||
// /my-endpoint/
|
||||
// /my-endpoint/intro
|
||||
// /my-endpoint/goodbye
|
||||
module.exports = function registerEndpoint(router) {
|
||||
router.get('/', (req, res) => res.send('Hello, World!'));
|
||||
router.get('/intro', (req, res) => res.send('Nice to meet you.'));
|
||||
@@ -33,13 +33,14 @@ module.exports = function registerEndpoint(router) {
|
||||
## 2. Develop your Custom Endpoint
|
||||
|
||||
The `registerEndpoint` function receives two parameters: `router` and `context`. Router is an express Router instance
|
||||
that is scoped to `/custom/<extension-name>`, while `context` holds the following properties:
|
||||
that is scoped to `/<extension-name>`, while `context` holds the following properties:
|
||||
|
||||
- `services` — All API internal services.
|
||||
- `exceptions` — API exception objects that can be used to throw "proper" errors.
|
||||
- `database` — Knex instance that is connected to the current database.
|
||||
- `getSchema` — Async function that reads the full available schema for use in services
|
||||
- `env` — Parsed environment variables.
|
||||
- `logger` — [Pino](https://github.com/pinojs/pino) instance.
|
||||
|
||||
## 3. Restart the API
|
||||
|
||||
|
||||
@@ -75,6 +75,7 @@ module.exports = function registerHook({ exceptions }) {
|
||||
| Scope | Actions | Before |
|
||||
| ------------------------------- | ----------------------------------------------------------- | ---------------- |
|
||||
| `cron()` | [See below for configuration](#interval-cron) | No |
|
||||
| `cli.init` | `before` and `after` | No |
|
||||
| `server` | `start` and `stop` | Optional |
|
||||
| `init` | | Optional |
|
||||
| `routes.init` | `before` and `after` | No |
|
||||
@@ -82,6 +83,7 @@ module.exports = function registerHook({ exceptions }) {
|
||||
| `middlewares.init` | `before` and `after` | No |
|
||||
| `request` | `not_found` | No |
|
||||
| `response` | | No<sup>[1]</sup> |
|
||||
| `database.error` | When a database error is thrown | No |
|
||||
| `error` | | No |
|
||||
| `auth` | `login`, `logout`<sup>[1]</sup> and `refresh`<sup>[1]</sup> | Optional |
|
||||
| `oauth.:provider`<sup>[2]</sup> | `login` and `redirect` | Optional |
|
||||
@@ -89,7 +91,7 @@ module.exports = function registerHook({ exceptions }) {
|
||||
| `activity` | `create`, `update` and `delete` | Optional |
|
||||
| `collections` | `create`, `update` and `delete` | Optional |
|
||||
| `fields` | `create`, `update` and `delete` | Optional |
|
||||
| `files` | `upload`<sup>[3]</sup>, `create`, `update` and `delete` | Optional |
|
||||
| `files` | `upload`<sup>[3]</sup> | No |
|
||||
| `folders` | `create`, `update` and `delete` | Optional |
|
||||
| `permissions` | `create`, `update` and `delete` | Optional |
|
||||
| `presets` | `create`, `update` and `delete` | Optional |
|
||||
@@ -141,7 +143,7 @@ module.exports = function registerHook() {
|
||||
## 4. Develop your Custom Hook
|
||||
|
||||
> Hooks can impact performance when not carefully implemented. This is especially true for `before` hooks (as these are
|
||||
> blocking) and hooks on `read` actions, as a single request can result in a large ammount of database reads.
|
||||
> blocking) and hooks on `read` actions, as a single request can result in a large amount of database reads.
|
||||
|
||||
### Register Function
|
||||
|
||||
@@ -155,6 +157,7 @@ The `registerHook` function receives a context parameter with the following prop
|
||||
- `database` — Knex instance that is connected to the current database
|
||||
- `getSchema` — Async function that reads the full available schema for use in services
|
||||
- `env` — Parsed environment variables
|
||||
- `logger` — [Pino](https://github.com/pinojs/pino) instance.
|
||||
|
||||
### Event Handler Function
|
||||
|
||||
|
||||
@@ -95,12 +95,12 @@ npm init -y
|
||||
```
|
||||
|
||||
To be read by the Admin App, your custom display's Vue component must first be bundled into a single `index.js` file. We
|
||||
recommend bundling your code using the directus-extension CLI from our `@directus/extension-sdk` package. The CLI
|
||||
recommend bundling your code using the directus-extension CLI from our `@directus/extensions-sdk` package. The CLI
|
||||
internally uses a Rollup configuration tailored specifically to bundling Directus extensions. To install the Extension
|
||||
SDK, run this command:
|
||||
|
||||
```bash
|
||||
npm i -D @directus/extension-sdk
|
||||
npm i -D @directus/extensions-sdk
|
||||
```
|
||||
|
||||
For the directus-extension CLI to recognize the extension type, the input path and the output path, add this field to
|
||||
|
||||
@@ -82,7 +82,7 @@ field on the parent Collection. If the chosen Related Collection already exists,
|
||||
selected. If the Related Collection does not already exist, you will be prompted to enter the name of its new primary
|
||||
key field.
|
||||
|
||||

|
||||

|
||||
|
||||
#### One-to-Many
|
||||
|
||||
@@ -90,7 +90,7 @@ The [One-to-Many](/concepts/relationships/#one-to-many-o2m) creates an [Alias](/
|
||||
parent Collection. To configure, enter or select a Related Collection and a field therein for storing the foreign key.
|
||||
The related field must have a data type that matches the type of "This" Collection's primary key field.
|
||||
|
||||

|
||||

|
||||
|
||||
The optional **Sort Field** can be used enable the reordering of items within the O2M field. Configured by entering the
|
||||
name/key of a Field (numeric type only) from the Related Collection.
|
||||
@@ -103,7 +103,7 @@ parent Collection. To configure, enter or select a Related Collection and a fiel
|
||||
To configure the Junction Collection, you can leave "Auto Fill" enabled to let Directus generate intelligent defaults,
|
||||
or disable it to select existing options or enter custom naming.
|
||||
|
||||

|
||||

|
||||
|
||||
#### Many-to-Any
|
||||
|
||||
@@ -114,7 +114,7 @@ automatically be referenced.
|
||||
To configure the Junction Collection, you can leave "Auto Fill" enabled to let Directus generate intelligent defaults,
|
||||
or disable it to select existing options or enter custom naming.
|
||||
|
||||

|
||||

|
||||
|
||||
#### Translations
|
||||
|
||||
@@ -122,7 +122,7 @@ or disable it to select existing options or enter custom naming.
|
||||
parent Collection. The easiest way to create this is to use the modal wizard, which only asks for the Translation field
|
||||
name:
|
||||
|
||||

|
||||

|
||||
|
||||
If you choose to switch to the **manual editor**, enter or select a Related Collection and a field therein for storing
|
||||
the foreign key.
|
||||
@@ -130,7 +130,7 @@ the foreign key.
|
||||
To configure the Translations Collection, you can leave "Auto Fill" enabled to let Directus generate intelligent
|
||||
defaults, or disable it to select existing options or enter custom naming.
|
||||
|
||||

|
||||

|
||||
|
||||
### Field Setup
|
||||
|
||||
|
||||
@@ -116,6 +116,26 @@ networks:
|
||||
directus:
|
||||
```
|
||||
|
||||
### Updating with Docker Compose
|
||||
|
||||
If you are not using the `latest` tag for directus you need to adjust your `docker-compose.yml` file to increment the
|
||||
tag version number, e.g.
|
||||
|
||||
```
|
||||
- image: directus/directus:9.0.0-rc.89
|
||||
+ image: directus/directus:9.0.0-rc.90
|
||||
```
|
||||
|
||||
You can then issue the following two commands (from your docker-compose root):
|
||||
|
||||
```
|
||||
docker-compose pull
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
The images will be pulled and the containers recreated. Migrations will happen automatically so once the containers have
|
||||
started you will be on the newest version (or the version you specified).
|
||||
|
||||
## Supported Databases
|
||||
|
||||
The Directus Docker Image contains all optional dependencies supported in the API. This means the Docker image can be
|
||||
|
||||
117
docs/guides/installation/plesk.md
Normal file
@@ -0,0 +1,117 @@
|
||||
# Shared Hosting with Plesk
|
||||
|
||||
On many shared hosts you are not allowed to directly invoke node commands but you have to use the Plesk configuration
|
||||
panel instead. Unfortunately, Plesk does not allow the interactive execution of node scripts. Therefore we can't use
|
||||
Directus' `init` script and have to set up the project by our own.
|
||||
|
||||
::: tip Successful tests
|
||||
|
||||
This approach has successfully been tested with a webhosting offer from netcup.
|
||||
|
||||
:::
|
||||
|
||||
## Setup database
|
||||
|
||||
First, make sure that you've already created a database and a user for it. We will use MySQL in this guide. When you
|
||||
plan to use SQLite you can ignore this.
|
||||
|
||||
## Setup a project folder
|
||||
|
||||
On the server, create a project folder with 4 files in it.
|
||||
|
||||
### 1. Add .env file
|
||||
|
||||
This file is used to configure Directus. Normally, the `init` script would create it for us. So now we have to do it
|
||||
manually. You can just copy it from another Directus installation or use the
|
||||
[example file](https://github.com/directus/directus/blob/main/api/example.env) of Directus and then modify it (see
|
||||
[Environment Variables](/reference/environment-variables/)). You likely have to adjust the database information.
|
||||
|
||||
If you have not already a user in the database make sure to add a first user by adding the following two lines so that
|
||||
you can later login to Directus.
|
||||
|
||||
```
|
||||
ADMIN_EMAIL="admin@example.com"
|
||||
ADMIN_PASSWORD="password"
|
||||
```
|
||||
|
||||
::: tip Choosing a Port
|
||||
|
||||
Since Plesk uses the [Phusion Passenger](https://www.phusionpassenger.com/) application server to serve Node.js apps you
|
||||
do not need to worry about choosing a specific port. Just use an arbitrary number. To quote the Passenger docs:
|
||||
|
||||
> When run in Passenger, the port number that you pass to listen() is irrelevant and has no effect. Passenger always
|
||||
> makes the app listen on a random Unix domain socket.
|
||||
|
||||
:::
|
||||
|
||||
### 2. Add package.json
|
||||
|
||||
Add Directus and your database connector as a dependency. To execute Directus' `bootstrap` command you also have to add
|
||||
a script entry for it.
|
||||
|
||||
```
|
||||
{
|
||||
"scripts": {
|
||||
"bootstrap": "directus bootstrap"
|
||||
},
|
||||
"dependencies": {
|
||||
"directus": "*",
|
||||
"mysql": "^2.18.1"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 3. Add application startup file index.js
|
||||
|
||||
Instead of a start command, Plesk wants a startup file. So create a `index.js` with the following content:
|
||||
|
||||
```
|
||||
var { default: start } = require('directus/dist/start');
|
||||
start();
|
||||
```
|
||||
|
||||
### 4. Add .npmrc
|
||||
|
||||
Lastly, we need to make a small configuration for npm by creating a `.npmrc` file with the following content:
|
||||
|
||||
```
|
||||
scripts-prepend-node-path=true
|
||||
```
|
||||
|
||||
## Activate and configure node.js
|
||||
|
||||
In Plesk, choose your website and click "Node.js". You should then see a button "Enable Node.js" and click on it.
|
||||
|
||||
Now, change the "Document root" and "Application root" to the location of your project folder. "Application startup
|
||||
file" must point to the `index.js` file from the former step. The screen should now look like this:
|
||||
|
||||

|
||||
|
||||
You can now install the dependencies by clicking on the button "NPM install".
|
||||
|
||||
## Bootstrap Directus
|
||||
|
||||
To set up the database tables (and the first user) for Directus, click on the button "Run script" and input `bootstrap`.
|
||||
You get the console output after the script has run through.
|
||||
|
||||
::: tip Current Issue of Argon2
|
||||
|
||||
You may run into an error of argon2 telling you that glibc is missing. If that's the case try adding and running this
|
||||
script entry to your package.json:
|
||||
|
||||
```
|
||||
"scripts" {
|
||||
"argon2-rebuild": "npm rebuild argon2 --build-from-source",
|
||||
<...>
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
Afterwards try `bootstrap` again.
|
||||
|
||||
:::
|
||||
|
||||
## Test Directus Access
|
||||
|
||||
The Directus app should now work under your configured url. If not, try changing the development mode and wait a couple
|
||||
of seconds.
|
||||
@@ -86,12 +86,12 @@ npm init -y
|
||||
```
|
||||
|
||||
To be read by the Admin App, your custom interface's Vue component must first be bundled into a single `index.js` file.
|
||||
We recommend bundling your code using the directus-extension CLI from our `@directus/extension-sdk` package. The CLI
|
||||
We recommend bundling your code using the directus-extension CLI from our `@directus/extensions-sdk` package. The CLI
|
||||
internally uses a Rollup configuration tailored specifically to bundling Directus extensions. To install the Extension
|
||||
SDK, run this command:
|
||||
|
||||
```bash
|
||||
npm i -D @directus/extension-sdk
|
||||
npm i -D @directus/extensions-sdk
|
||||
```
|
||||
|
||||
For the directus-extension CLI to recognize the extension type, the input path and the output path, add this field to
|
||||
|
||||
@@ -30,8 +30,8 @@ export default {
|
||||
sidebar: () => null,
|
||||
actions: () => null,
|
||||
},
|
||||
setup(props) {
|
||||
const name = ref('Custom layout state');
|
||||
setup() {
|
||||
const name = ref('Custom Layout');
|
||||
|
||||
return { name };
|
||||
},
|
||||
@@ -55,19 +55,24 @@ for more info on what can go into this object.
|
||||
|
||||
```vue
|
||||
<template>
|
||||
<div>{{ name }} - Collection: {{ props.collection }}</div>
|
||||
<div>
|
||||
<p>Name: {{ name }}</p>
|
||||
<p>Collection: {{ collection }}</p>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { toRefs } from 'vue';
|
||||
import { useLayoutState } from '@directus/extension-sdk';
|
||||
|
||||
export default {
|
||||
setup() {
|
||||
const layoutState = useLayoutState();
|
||||
const { props, name } = toRefs(layoutState.value);
|
||||
|
||||
return { props, name };
|
||||
inheritAttrs: false,
|
||||
props: {
|
||||
collection: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
name: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
@@ -91,12 +96,12 @@ npm init -y
|
||||
```
|
||||
|
||||
To be read by the Admin App, your custom layouts's Vue component must first be bundled into a single `index.js` file. We
|
||||
recommend bundling your code using the directus-extension CLI from our `@directus/extension-sdk` package. The CLI
|
||||
recommend bundling your code using the directus-extension CLI from our `@directus/extensions-sdk` package. The CLI
|
||||
internally uses a Rollup configuration tailored specifically to bundling Directus extensions. To install the Extension
|
||||
SDK, run this command:
|
||||
|
||||
```bash
|
||||
npm i -D @directus/extension-sdk
|
||||
npm i -D @directus/extensions-sdk
|
||||
```
|
||||
|
||||
For the directus-extension CLI to recognize the extension type, the input path and the output path, add this field to
|
||||
|
||||
@@ -60,10 +60,9 @@ export default {};
|
||||
|
||||
#### Accessing the API from within your extension
|
||||
|
||||
The Directus App's Vue app instance provides a field called `system`, which can be injected into Vue components using
|
||||
[Vue's inject framework](https://v3.vuejs.org/guide/component-provide-inject.html). This `system` field contains
|
||||
functions to access Vuex stores, and more importantly, contains a property called `api`, which is an authenticated Axios
|
||||
instance. Here's an example of how to use it:
|
||||
The Directus App's Vue app instance provides a field called `api`, which can be injected into Vue components using
|
||||
[Vue's inject framework](https://v3.vuejs.org/guide/component-provide-inject.html). This `api` field contains a property
|
||||
called `api`, which is an authenticated Axios instance. Here's an example of how to use it:
|
||||
|
||||
```vue
|
||||
<template>
|
||||
@@ -89,14 +88,14 @@ export default {
|
||||
console.log(this.collections);
|
||||
},
|
||||
},
|
||||
inject: ['system'],
|
||||
inject: ['api'],
|
||||
mounted() {
|
||||
// log the system field so you can see what attributes are available under it
|
||||
// remove this line when you're done.
|
||||
console.log(this.system);
|
||||
console.log(this.api);
|
||||
|
||||
// Get a list of all available collections to use with this module
|
||||
this.system.api.get('/collections?limit=-1').then((res) => {
|
||||
this.api.get('/collections?limit=-1').then((res) => {
|
||||
this.collections = res.data.data;
|
||||
});
|
||||
},
|
||||
@@ -106,14 +105,14 @@ export default {
|
||||
|
||||
In the above example, you can see that:
|
||||
|
||||
- The `system` field gets injected into the component and becomes available as an attribute of the component (ie
|
||||
`this.system`)
|
||||
- When the component is mounted, it uses `this.system.api.get` to request a list of all available collections
|
||||
- The `api` field gets injected into the component and becomes available as an attribute of the component (ie
|
||||
`this.api`)
|
||||
- When the component is mounted, it uses `this.api.get` to request a list of all available collections
|
||||
- The names of the collections are rendered into a list in the component's template
|
||||
- a button is added with a method the logs all the data for the collections to the console
|
||||
|
||||
This is just a basic example. A more efficient way to access and work with the list of collections would be to get an
|
||||
instance of the `collectionsStore` using `system.useCollectionsStore()`, but that's beyond the scope of this guide
|
||||
instance of the `collectionsStore` using `store.useCollectionsStore()`, but that's beyond the scope of this guide
|
||||
|
||||
#### Available Props
|
||||
|
||||
@@ -128,12 +127,12 @@ npm init -y
|
||||
```
|
||||
|
||||
To be read by the Admin App, your custom module's Vue component must first be bundled into a single `index.js` file. We
|
||||
recommend bundling your code using the directus-extension CLI from our `@directus/extension-sdk` package. The CLI
|
||||
recommend bundling your code using the directus-extension CLI from our `@directus/extensions-sdk` package. The CLI
|
||||
internally uses a Rollup configuration tailored specifically to bundling Directus extensions. To install the Extension
|
||||
SDK, run this command:
|
||||
|
||||
```bash
|
||||
npm i -D @directus/extension-sdk
|
||||
npm i -D @directus/extensions-sdk
|
||||
```
|
||||
|
||||
For the directus-extension CLI to recognize the extension type, the input path and the output path, add this field to
|
||||
@@ -144,7 +143,7 @@ the root of the `package.json` file:
|
||||
"type": "module",
|
||||
"path": "dist/index.js",
|
||||
"source": "src/index.js",
|
||||
"host": "^9.0.0-rc.87",
|
||||
"host": "^9.0.0-rc.92",
|
||||
"hidden": false
|
||||
}
|
||||
```
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@directus/docs",
|
||||
"private": false,
|
||||
"version": "9.0.0-rc.90",
|
||||
"version": "9.0.0-rc.92",
|
||||
"description": "",
|
||||
"main": "dist/index.js",
|
||||
"scripts": {
|
||||
@@ -32,7 +32,7 @@
|
||||
"directory-tree": "2.3.1",
|
||||
"fs-extra": "10.0.0",
|
||||
"lodash.get": "4.4.2",
|
||||
"micromark": "3.0.0",
|
||||
"micromark": "3.0.5",
|
||||
"npm-watch": "0.11.0",
|
||||
"slugify": "1.6.0",
|
||||
"vuepress": "1.8.2",
|
||||
|
||||
@@ -65,7 +65,7 @@ example.com/assets/1ac73658-8b62-4dea-b6da-529fbc9d01a4?fit=cover&width=200&heig
|
||||
```
|
||||
|
||||
For even more advanced control over the file generation, Directus exposes
|
||||
[the full `sharp` API](https://sharp.pixelplumbing.com/api-operation) through the `transform` query parameter. This
|
||||
[the full `sharp` API](https://sharp.pixelplumbing.com/api-operation) through the `transforms` query parameter. This
|
||||
parameter accepts a two-dimensional array with the format `[Operation, ...arguments]`, for example:
|
||||
|
||||
```
|
||||
|
||||
@@ -50,9 +50,6 @@ Additional default values for the role.
|
||||
`fields` **array**\
|
||||
What fields the user is allowed to alter.
|
||||
|
||||
`limit` **integer**\
|
||||
How many items the user is able to alter at once in batch operations.
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="right">
|
||||
@@ -72,8 +69,7 @@ How many items the user is able to alter at once in batch operations.
|
||||
"presets": {
|
||||
"published": false
|
||||
},
|
||||
"fields": ["title", "translations"],
|
||||
"limit": null
|
||||
"fields": ["title", "translations"]
|
||||
}
|
||||
```
|
||||
|
||||
@@ -190,8 +186,7 @@ GET /permissions/:id
|
||||
"presets": {
|
||||
"published": false
|
||||
},
|
||||
"fields": ["title", "translations"],
|
||||
"limit": null
|
||||
"fields": ["title", "translations"]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
@@ -23,17 +23,18 @@ needs to be publicly available on the internet.
|
||||
|
||||
## Database
|
||||
|
||||
| Variable | Description | Default Value |
|
||||
| ---------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- | ------------- |
|
||||
| `DB_CLIENT` | **Required**. What database client to use. One of `pg` or `postgres`, `mysql`, `oracledb`, `mssql`, or `sqlite3`. | -- |
|
||||
| `DB_HOST` | Database host. **Required** when using `pg`, `mysql`, `oracledb`, or `mssql`. | -- |
|
||||
| `DB_PORT` | Database port. **Required** when using `pg`, `mysql`, `oracledb`, or `mssql`. | -- |
|
||||
| `DB_DATABASE` | Database name. **Required** when using `pg`, `mysql`, `oracledb`, or `mssql`. | -- |
|
||||
| `DB_USER` | Database user. **Required** when using `pg`, `mysql`, `oracledb`, or `mssql`. | -- |
|
||||
| `DB_PASSWORD` | Database user's password. **Required** when using `pg`, `mysql`, `oracledb`, or `mssql`. | -- |
|
||||
| `DB_FILENAME` | Where to read/write the SQLite database. **Required** when using `sqlite3`. | -- |
|
||||
| `DB_CONNECTION_STRING` | When using `pg`, you can submit a connection string instead of individual properties. Using this will ignore any of the other connection settings. | -- |
|
||||
| `DB_POOL_*` | Pooling settings. Passed on to [the `tarn.js`](https://github.com/vincit/tarn.js#usage) library. | -- |
|
||||
| Variable | Description | Default Value |
|
||||
| ---------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- | --------------- |
|
||||
| `DB_CLIENT` | **Required**. What database client to use. One of `pg` or `postgres`, `mysql`, `oracledb`, `mssql`, or `sqlite3`. | -- |
|
||||
| `DB_HOST` | Database host. **Required** when using `pg`, `mysql`, `oracledb`, or `mssql`. | -- |
|
||||
| `DB_PORT` | Database port. **Required** when using `pg`, `mysql`, `oracledb`, or `mssql`. | -- |
|
||||
| `DB_DATABASE` | Database name. **Required** when using `pg`, `mysql`, `oracledb`, or `mssql`. | -- |
|
||||
| `DB_USER` | Database user. **Required** when using `pg`, `mysql`, `oracledb`, or `mssql`. | -- |
|
||||
| `DB_PASSWORD` | Database user's password. **Required** when using `pg`, `mysql`, `oracledb`, or `mssql`. | -- |
|
||||
| `DB_FILENAME` | Where to read/write the SQLite database. **Required** when using `sqlite3`. | -- |
|
||||
| `DB_CONNECTION_STRING` | When using `pg`, you can submit a connection string instead of individual properties. Using this will ignore any of the other connection settings. | -- |
|
||||
| `DB_POOL_*` | Pooling settings. Passed on to [the `tarn.js`](https://github.com/vincit/tarn.js#usage) library. | -- |
|
||||
| `DB_EXCLUDE_TABLES` | CSV of tables you want Directus to ignore completely | spatial_ref_sys |
|
||||
|
||||
::: tip Additional Database Variables
|
||||
|
||||
@@ -73,6 +74,32 @@ your project and API on different domains, make sure to verify your configuratio
|
||||
|
||||
:::
|
||||
|
||||
### Hashing
|
||||
|
||||
| Variable | Description | Default Value |
|
||||
| ---------------------- | -------------------------------------------------------------------------------------------------------------------------------- | ------------------- |
|
||||
| `HASH_MEMORY_COST` | How much memory to use when generating hashes, in KiB. | `4096` (4 MiB) |
|
||||
| `HASH_LENGTH` | The length of the hash function output in bytes. | `32` |
|
||||
| `HASH_TIME_COST` | The amount of passes (iterations) used by the hash function. It increases hash strength at the cost of time required to compute. | `3` |
|
||||
| `HASH_PARALLELISM` | The amount of threads to compute the hash on. Each thread has a memory pool with `HASH_MEMORY_COST` size. | `1` (single thread) |
|
||||
| `HASH_TYPE` | The variant of the hash function (`0`: argon2d, `1`: argon2i, or `2`: argon2id). | `1` (argon2i) |
|
||||
| `HASH_ASSOCIATED_DATA` | An extra and optional non-secret value. The value will be included B64 encoded in the parameters portion of the digest. | -- |
|
||||
|
||||
Argon2's hashing function is used by Directus for three purposes: 1) hashing user passwords, 2) generating hashes for
|
||||
the `Hash` field type in collections, and 3) the
|
||||
[generate a hash API endpoint](https://docs.directus.io/reference/api/system/utilities/#generate-a-hash).
|
||||
|
||||
All `HASH_*` environment variable parameters are passed to the `argon2.hash` function. See the
|
||||
[node-argon2 library options page](https://github.com/ranisalt/node-argon2/wiki/Options) for reference.
|
||||
|
||||
::: tip Memory Usage
|
||||
|
||||
Modifying `HASH_MEMORY_COST` and/or `HASH_PARALLELISM` will affect the amount of memory directus uses when computing
|
||||
hashes; each thread gets `HASH_MEMORY_COST` amount of memory, so the total additional memory will be these two values
|
||||
multiplied. This may cause out of memory errors, especially when running in containerized environments.
|
||||
|
||||
:::
|
||||
|
||||
## CORS
|
||||
|
||||
| Variable | Description | Default Value |
|
||||
@@ -240,12 +267,12 @@ Based on your configured driver, you must also provide the following configurati
|
||||
|
||||
### Azure (`azure`)
|
||||
|
||||
| Variable | Description | Default Value |
|
||||
| ----------------------------------- | -------------------------- | ------------------------------------- |
|
||||
| `STORAGE_<LOCATION>_CONTAINER_NAME` | Azure Storage container | -- |
|
||||
| `STORAGE_<LOCATION>_ACCOUNT_NAME` | Azure Storage account name | -- |
|
||||
| `STORAGE_<LOCATION>_ACCOUNT_KEY` | Azure Storage key | -- |
|
||||
| `STORAGE_<LOCATION>_ENDPOINT` | Azure URL | "{ACCOUNT_KEY}.blob.core.windows.net" |
|
||||
| Variable | Description | Default Value |
|
||||
| ----------------------------------- | -------------------------- | --------------------------------------------- |
|
||||
| `STORAGE_<LOCATION>_CONTAINER_NAME` | Azure Storage container | -- |
|
||||
| `STORAGE_<LOCATION>_ACCOUNT_NAME` | Azure Storage account name | -- |
|
||||
| `STORAGE_<LOCATION>_ACCOUNT_KEY` | Azure Storage key | -- |
|
||||
| `STORAGE_<LOCATION>_ENDPOINT` | Azure URL | "https://{ACCOUNT_KEY}.blob.core.windows.net" |
|
||||
|
||||
### Google Cloud Storage (`gcs`)
|
||||
|
||||
|
||||
@@ -48,28 +48,28 @@
|
||||
|
||||
## Filter Operators
|
||||
|
||||
| Operator | Description |
|
||||
| --------------- | -------------------------------------- |
|
||||
| `_eq` | Equal to |
|
||||
| `_neq` | Not equal to |
|
||||
| `_lt` | Less than |
|
||||
| `_lte` | Less than or equal to |
|
||||
| `_gt` | Greater than |
|
||||
| `_gte` | Greater than or equal to |
|
||||
| `_in` | Exists in one of the values |
|
||||
| `_nin` | Not in one of the values |
|
||||
| `_null` | It is null |
|
||||
| `_nnull` | It is not null |
|
||||
| `_contains` | Contains the substring |
|
||||
| `_ncontains` | Doesn't contain the substring |
|
||||
| `_starts_with` | Contains the substring |
|
||||
| `_nstarts_with` | Doesn't contain the substring |
|
||||
| `_ends_with` | Contains the substring |
|
||||
| `_nends_with` | Doesn't contain the substring |
|
||||
| `_between` | The value is between two values |
|
||||
| `_nbetween` | The value is not between two values |
|
||||
| `_empty` | The value is empty (null or falsy) |
|
||||
| `_nempty` | The value is not empty (null or falsy) |
|
||||
| Operator | Description |
|
||||
| --------------- | ------------------------------------- |
|
||||
| `_eq` | Equal to |
|
||||
| `_neq` | Not equal to |
|
||||
| `_lt` | Less than |
|
||||
| `_lte` | Less than or equal to |
|
||||
| `_gt` | Greater than |
|
||||
| `_gte` | Greater than or equal to |
|
||||
| `_in` | Matches any of the values |
|
||||
| `_nin` | Doesn't match any of the values |
|
||||
| `_null` | Is `null` |
|
||||
| `_nnull` | Is not `null` |
|
||||
| `_contains` | Contains the substring |
|
||||
| `_ncontains` | Doesn't contain the substring |
|
||||
| `_starts_with` | Starts with |
|
||||
| `_nstarts_with` | Doesn't start with |
|
||||
| `_ends_with` | Ends with |
|
||||
| `_nends_with` | Doesn't end with |
|
||||
| `_between` | Is between two values (inclusive) |
|
||||
| `_nbetween` | Is not between two values (inclusive) |
|
||||
| `_empty` | Is empty (`null` or falsy) |
|
||||
| `_nempty` | Is not empty (`null` or falsy) |
|
||||
|
||||
The following operators are **only available in validation permissions**:
|
||||
|
||||
|
||||
@@ -480,10 +480,22 @@ await directus.auth.logout();
|
||||
|
||||
### Request a Password Reset
|
||||
|
||||
By default, the address defined in `PUBLIC_URL` on `.env` file is used for the link to the reset password page sent in
|
||||
the email:
|
||||
|
||||
```js
|
||||
await directus.auth.password.request('admin@example.com');
|
||||
```
|
||||
|
||||
But a custom address can be passed as second argument:
|
||||
|
||||
```js
|
||||
await directus.auth.password.request(
|
||||
'admin@example.com',
|
||||
'https://myapp.com' // In this case, the link will be https://myapp.com?token=FEE0A...
|
||||
);
|
||||
```
|
||||
|
||||
### Reset a Password
|
||||
|
||||
```js
|
||||
|
||||