- Bun
- Directus instance (Docker Compose)
- Google Maps API Key from here
Add the following environment variables to your docker-compose.yml
file, replacing the placeholder with your API key:
GOOGLE_MAPS_API_KEY: "REPLACE-WITH-API-KEY"
CONTENT_SECURITY_POLICY_DIRECTIVE__CONNECT_SRC: "'self' https:"
CONTENT_SECURITY_POLICY_DIRECTIVES__SCRIPT_SRC: "'self' 'unsafe-inline' 'unsafe-eval' https://maps.googleapis.com"
CONTENT_SECURITY_POLICY_DIRECTIVES__MEDIA_SRC: "'self' blob: data: https://maps.gstatic.com https://maps.googleapis.com"
CONTENT_SECURITY_POLICY_DIRECTIVES__IMG_SRC: "'self' blob: data: https://maps.gstatic.com https://maps.googleapis.com khmdb0.google.com khmdb0.googleapis.com khmdb1.google.com khmdb1.googleapis.com khm.google.com khm.googleapis.com khm0.google.com khm0.googleapis.com khm1.google.com khm1.googleapis.com khms0.google.com khms0.googleapis.com khms1.google.com khms1.googleapis.com khms2.google.com khms2.googleapis.com khms3.google.com khms3.googleapis.com streetviewpixels-pa.googleapis.com"
-
Build the extension:
bun run build
-
Upgrade the extension:
bun run upgrade <path>
Replace
<path>
with the path of the Directusextensions
folder, e.g.../directus/extensions/
.This will copy the built extension to the Directus extensions folder.
-
Install dependencies:
bun install
-
Build the extension:
bun run build
-
Link the extension to your Directus instance:
bun run link <path>
Replace
<path>
with the path of the Directusextensions
folder, e.g.../directus/extensions/
.
To automatically reload the extension when changes are made, without having to rebuild the extension and restart Directus, follow these steps:
-
Set this environment variable in your Directus instance:
EXTENSIONS_AUTO_RELOAD=true
This will usually be in your
docker-compose.yml
file. -
Build the extension and watch for changes:
bun dev