Skip to content

Commit

Permalink
add api key
Browse files Browse the repository at this point in the history
  • Loading branch information
chienleng committed May 6, 2024
1 parent ef701c0 commit 139bd1c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ PORT=8002
NUXT_ENV_HEADER_X_ONUU={apiKey}
MAPBOX_TOKEN={mapboxToken}
GITHUB_TOKEN={githubToken for release-it}
API_KEY={openNEMapiKey}
1 change: 1 addition & 0 deletions nuxt.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ module.exports = {

env: {
SITEWIDE_ANNOUNCEMENT: process.env.SITEWIDE_ANNOUNCEMENT,
API_KEY: process.env.API_KEY,
mapboxToken: process.env.MAPBOX_TOKEN || '',
DATA_BASE_URL: useDev
? 'https://data.dev.opennem.org.au/'
Expand Down
5 changes: 4 additions & 1 deletion services/Api.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import axios from 'axios'

const apiKey = process.env.API_KEY

const getApiBaseUrl = () => {
let apiBaseUrl = `https://api.opennem.org.au`
let host = undefined
Expand Down Expand Up @@ -35,7 +37,8 @@ const http = axios.create({
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
'X-ONAU': process.env.NUXT_ENV_HEADER_X_ONUU
'X-ONAU': process.env.NUXT_ENV_HEADER_X_ONUU,
Authorization: `Bearer ${apiKey}`
}
})

Expand Down

0 comments on commit 139bd1c

Please sign in to comment.