-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from davewalker5/MC-204-Ensure-Maps-Key-Retrieved
MC-204 Improve reliability of Google Maps API key retrieval and storage
- Loading branch information
Showing
12 changed files
with
89 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
FROM node:20-alpine | ||
COPY musiccatalogue.ui-1.21.0.0 /opt/musiccatalogue.ui-1.21.0.0 | ||
WORKDIR /opt/musiccatalogue.ui-1.21.0.0 | ||
COPY musiccatalogue.ui-1.22.0.0 /opt/musiccatalogue.ui-1.22.0.0 | ||
WORKDIR /opt/musiccatalogue.ui-1.22.0.0 | ||
RUN npm install | ||
RUN npm run build | ||
ENTRYPOINT [ "npm", "start" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,21 @@ | ||
import { setStorageValue, getStorageValue, clearStorageValue } from "./storage"; | ||
|
||
/** | ||
* Store the JWT token | ||
* @param {*} token | ||
*/ | ||
const apiSetToken = (token) => { | ||
// TODO: Move to HTTP Cookie | ||
localStorage.setItem("token", token); | ||
}; | ||
const apiSetToken = (token) => setStorageValue("token", token); | ||
|
||
/** | ||
* Retrieve the current JWT token | ||
* @param {*} token | ||
* @returns | ||
*/ | ||
const apiGetToken = () => { | ||
try { | ||
// TODO: Move to HTTP Cookie | ||
const token = localStorage.getItem("token"); | ||
return token; | ||
} catch { | ||
return null; | ||
} | ||
}; | ||
const apiGetToken = () => getStorageValue("token"); | ||
|
||
/** | ||
* Clear the current JWT token | ||
*/ | ||
const apiClearToken = () => { | ||
// TODO: Move to HTTP Cookie | ||
localStorage.removeItem("token"); | ||
}; | ||
const apiClearToken = () => clearStorageValue("token"); | ||
|
||
export { apiClearToken, apiSetToken, apiGetToken }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
const secrets = { | ||
mapsApiKey: "Maps API Key", | ||
}; | ||
|
||
export default secrets; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/** | ||
* Convert a name that may be mixed case and with spaces to a local storage key | ||
* @param {*} name | ||
* @returns | ||
*/ | ||
const getStorageKey = (name) => { | ||
const key = name.toLowerCase().replace(/ /g, "-"); | ||
return key; | ||
}; | ||
|
||
/** | ||
* Store a named value | ||
* @param {*} token | ||
* @param {*} value | ||
*/ | ||
const setStorageValue = (name, value) => { | ||
const key = getStorageKey(name); | ||
localStorage.setItem(key, value); | ||
}; | ||
|
||
/** | ||
* Retrieve a stored value | ||
* @param {*} name | ||
* @returns | ||
*/ | ||
const getStorageValue = (name) => { | ||
try { | ||
const key = getStorageKey(name); | ||
const token = localStorage.getItem(key); | ||
return token; | ||
} catch { | ||
return null; | ||
} | ||
}; | ||
|
||
/** | ||
* Clear a named storage value | ||
* @param {*} name | ||
*/ | ||
const clearStorageValue = (name) => { | ||
const key = getStorageKey(name); | ||
localStorage.removeItem(key); | ||
}; | ||
|
||
export { setStorageValue, getStorageValue, clearStorageValue }; |