Migrate via Wrangler
Step 1: Extract your current configuration
Inside your Worker project, locate the script from DataDome.
Step 2: Map the v1 configuration to your v2 configuration
- Retrieve the specific values that you may have set to configure your DataDome Worker that are not the default value to reuse them in the Worker v2 integration.
| Name in Worker v1 | Default value | Name in Worker v2 |
|---|---|---|
| DATADOME_LICENSE_KEY | 'YOUR_DATADOME_SERVER_KEY' | DATADOME_SERVER_SIDE_KEY |
| DATADOME_JS_KEY | '' | DATADOME_CLIENT_SIDE_KEY |
| DATADOME_JS_URL | 'https://js.datadome.co/tags.js' | DATADOME_JS_URL |
| DATADOME_JS_ENDPOINT | '' | DATADOME_JS_ENDPOINT |
| DATADOME_JS_TAG_OPTIONS | '{ "ajaxListenerPath": true }’ | DATADOME_JS_TAG_OPTIONS |
| DATADOME_TIMEOUT | 300 | DATADOME_TIMEOUT |
| DATADOME_LOG_VALUES | [] | DATADOME_LOGPUSH_CONFIGURATION |
| DATADOME_URI_REGEX | null | Fused with DATADOME_URL_REGEX_INCLUSION |
| DATADOME_URL_REGEX | null | DATADOME_URL_REGEX_INCLUSION |
| DATADOME_URI_REGEX_EXCLUSION | See list of static assets below. | DATADOME_URI_REGEX_EXCLUSION |
| DATADOME_HOSTNAME_REGEX_EXCLUSION | null | Is now set inside Worker's Triggers -> Custom Domains |
| DATADOME_JS_HOSTNAME_REGEX_EXCLUSION | null | Fused with DATADOME_JS_URL_REGEX_EXCLUSION |
| DATADOME_JS_URI_REGEX_EXCLUSION | null | Fused with DATADOME_JS_URL_REGEX_INCLUSION |
| DATADOME_URL_REGEX_EXCLUSION | null | DATADOME_JS_URL_REGEX_EXCLUSION |
| DATADOME_JS_URL_REGEX | null | DATADOME_JS_URL_REGEX_INCLUSION |
| DATADOME_IP_FILTERING | null | DATADOME_IP_EXCLUSION |
| DATADOME_ENABLE_DEBUGGING | false | DATADOME_ENABLE_DEBUGGING |
| DATADOME_ENABLE_GRAPHQL_SUPPORT | false | DATADOME_ENABLE_GRAPHQL_SUPPORT |
/\.(avi|flv|mka|mkv|mov|mp4|mpeg|mpg|mp3|flac|ogg|ogm|opus|wav|webm|webp|bmp|gif|ico|jpeg|jpg|png|svg|svgz|swf|eot|otf|ttf|woff|woff2|css|less|js|map)$/i
Step 3: migrate to new version
- Download the latest version of our Cloudflare Worker script.
- Copy the file
datadome.tsinto your Wrangler project. - Update the settings in the code of
datadome.tsusing the table created in step 2. - Create a Cloudflare Worker secret named
DATADOME_SERVER_SIDE_KEY:
wrangler secret put DATADOME_SERVER_SIDE_KEY
A prompt appears. Enter the value of your DataDome server-side key you can find in your DataDome Dashboard.
- Create a Cloudflare Worker secret named
DATADOME_CLIENT_SIDE_KEY:
wrangler secret put DATADOME_CLIENT_SIDE_KEY
A prompt appears. Enter the value of your DataDome client-side key you can find in your DataDome Dashboard.
- Update your
wrangler.tomlfile:
- Change the value of
mainwith the path to thedatadome.tsfile, - Add the
routekey to configure the domains and routes you want to set the DataDome Worker on.
name = "datadome-worker"
main = "src/datadome.ts"
route = { pattern = "example.org/*", zone_name = "example.org" }
- Deploy your Worker (you will be asked to authenticate with Cloudflare if you are not logged in already):
wrangler deploy
- Congrats! You migrated from DataDome Worker v1 to DataDome Worker v2!
Updated 4 months ago
