Skip to content
This repository was archived by the owner on Jun 3, 2025. It is now read-only.

Commit 6bdb1ab

Browse files
JWandrockeGitHub Enterprise
authored andcommitted
Merge pull request #41 from ML-Leonardo/feature/dynamic_api_root
SAPMLCONV-8899 - support for dynamic URL
2 parents ec3dc37 + 380decf commit 6bdb1ab

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/config.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1-
export default {
2-
apiUrl: 'https://api.cai.tools.sap/connect/v1',
3-
}
1+
const config = (() => {
2+
const script = document.currentScript || document.getElementById('cai-webchat')
3+
const apiRoot = script.getAttribute('apiRoot') || 'https://api.cai.tools.sap'
4+
5+
return {
6+
apiUrl: `${apiRoot}${apiRoot.slice(-1) === '/' ? '' : '/'}connect/v1`,
7+
}
8+
})()
9+
10+
export default config

0 commit comments

Comments
 (0)