Skip to content

Commit

Permalink
fix: API URLs issue #97 (#98)
Browse files Browse the repository at this point in the history
* addresses issue #97

Moves api urls to (.)ENV
set utls to new api.realtoken.community domain (previously api.realt.community)

* Update .env.sample

missing update of sample .env

* Update .env.sample

* NEXT_PUBLIC_ prefix removed for REALTOKENAPI ENV vars
  • Loading branch information
BenoistP authored Dec 18, 2024
1 parent 81848e4 commit e24c8c5
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -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/'
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 4 additions & 2 deletions src/pages/api/history/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
})
Expand Down
6 changes: 4 additions & 2 deletions src/pages/api/properties/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
})
Expand Down

0 comments on commit e24c8c5

Please sign in to comment.