Skip to content

Commit 60ef61a

Browse files
authored
[MOB-5933]: EU Domain Configuration (#199)
* temp * add env var to hit EU service * remove test changes * update naming and comments * update env example value name --------- Co-authored-by: mitch prewitt <[email protected]>
1 parent e923e41 commit 60ef61a

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

.env.example

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,10 @@
22
# called .env and add these values to it and change them appropriately.
33
# Remember to uncomment the variables!
44

5+
# Only set BASE_URL if developing locally, as it will take precedence over the production api urls
56
# BASE_URL="https://api.iterable.com/api"
7+
68
# ENABLE_INAPP_CONSUME=false
9+
10+
# toggle this to true if you would need to hit our EU APIs
11+
# IS_EU_ITERABLE_SERVICE=false

src/constants.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,19 @@ export const DISPLAY_INTERVAL_DEFAULT = 30000;
44
/* how many times we try to create a new user when _setUserID_ is invoked */
55
export const RETRY_USER_ATTEMPTS = 0;
66

7-
export const BASE_URL = process.env.BASE_URL || 'https://api.iterable.com/api';
7+
const IS_EU_ITERABLE_SERVICE =
8+
process.env.IS_EU_ITERABLE_SERVICE === 'true' ? true : false;
9+
10+
const US_ITERABLE_DOMAIN = 'api.iterable.com';
11+
12+
const EU_ITERABLE_DOMAIN = 'api.eu.iterable.com';
13+
14+
const ITERABLE_API_URL = `https://${
15+
IS_EU_ITERABLE_SERVICE ? EU_ITERABLE_DOMAIN : US_ITERABLE_DOMAIN
16+
}/api`;
17+
18+
// Do not set `process.env.BASE_URL` if intending on using the prod or EU APIs.
19+
export const BASE_URL = process.env.BASE_URL || ITERABLE_API_URL;
820

921
export const GETMESSAGES_PATH = '/inApp/web/getMessages';
1022

0 commit comments

Comments
 (0)