diff --git a/.env.sample b/.env.sample index 2307bc53..3dbc10d9 100644 --- a/.env.sample +++ b/.env.sample @@ -1,3 +1,5 @@ BUILD_ENV= COMMUNITY_API_KEY= THEGRAPH_API_KEY= +REALTOKENAPI='https://api.realtoken.community/v1/token' +REALTOKENAPI_HISTORY='https://history.api.realtoken.community/' \ No newline at end of file diff --git a/README.md b/README.md index 920d7d04..b7643d6a 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,9 @@ To run the project you will need to set-up a `.env` file in the root folder: ``` COMMUNITY_API_KEY=XXXXXXXXXXXX THEGRAPH_API_KEY=XXXXXXXXXXXX + +REALTOKENAPI='https://api.realtoken.community/v1/token' +REALTOKENAPI_HISTORY='https://history.api.realtoken.community/' ``` To get a `COMMUNITY_API_KEY`, join the dedicated [telegram dev channel](https://t.me/+XQyoaFfmN61yk7X0) then ask for. diff --git a/src/pages/api/history/index.ts b/src/pages/api/history/index.ts index 976dfc02..7305ad8e 100644 --- a/src/pages/api/history/index.ts +++ b/src/pages/api/history/index.ts @@ -8,8 +8,10 @@ const getRealTokenHistory = useCache( if (!process.env.COMMUNITY_API_KEY) { throw new Error('Missing COMMUNITY_API_KEY env variable') } - - const response = await fetch('https://history.api.realt.community/', { + if (!process.env.REALTOKENAPI_HISTORY) { + throw new Error('Missing REALTOKENAPI_HISTORY env variable') + } + const response = await fetch(process.env.REALTOKENAPI_HISTORY, { method: 'GET', headers: { 'X-AUTH-REALT-TOKEN': process.env.COMMUNITY_API_KEY }, }) diff --git a/src/pages/api/properties/index.ts b/src/pages/api/properties/index.ts index aba106e2..45f8c7be 100644 --- a/src/pages/api/properties/index.ts +++ b/src/pages/api/properties/index.ts @@ -8,8 +8,10 @@ const getRealTokenList = useCache( if (!process.env.COMMUNITY_API_KEY) { throw new Error('Missing COMMUNITY_API_KEY env variable') } - - const response = await fetch('https://api.realt.community/v1/token', { + if (!process.env.REALTOKENAPI) { + throw new Error('Missing REALTOKENAPI env variable') + } + const response = await fetch(process.env.REALTOKENAPI, { method: 'GET', headers: { 'X-AUTH-REALT-TOKEN': process.env.COMMUNITY_API_KEY }, })