generated from ConductionNL/product-website-template
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
106 additions
and
33 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
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import Rotterdam from "./../../static/configFiles/rotterdam.json"; | ||
|
||
export const getConfig = (domain: string): Record<string, any> | undefined => { | ||
switch (domain) { | ||
case "localhost": | ||
return Rotterdam as Record<string, any>; | ||
} | ||
}; |
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,48 @@ | ||
import { getConfig } from "./getConfig"; | ||
|
||
export const initiateEnvironment = () => { | ||
const varsAvailable = process.env.GATSBY_ENV_VARS_SET === "true"; | ||
|
||
if (varsAvailable) { | ||
window.sessionStorage.setItem("API_BASE_URL", process.env.GATSBY_API_BASE_URL ?? ""); | ||
window.sessionStorage.setItem("NL_DESIGN_THEME_CLASSNAME", process.env.GATSBY_NL_DESIGN_THEME_CLASSNAME ?? ""); | ||
window.sessionStorage.setItem("FAVICON_URL", process.env.GATSBY_FAVICON_URL ?? ""); | ||
window.sessionStorage.setItem("ORGANISATION_NAME", process.env.GATSBY_ORGANISATION_NAME ?? ""); | ||
window.sessionStorage.setItem("JUMBOTRON_IMAGE_URL", process.env.GATSBY_JUMBOTRON_IMAGE_URL ?? ""); | ||
window.sessionStorage.setItem("FOOTER_LOGO_HREF", process.env.GATSBY_FOOTER_LOGO_HREF ?? ""); | ||
window.sessionStorage.setItem("FOOTER_CONTENT", process.env.FOOTER_CONTENT ?? ""); | ||
window.sessionStorage.setItem("FOOTER_CONTENT_HEADER", process.env.GATSBY_FOOTER_CONTENT_HEADER ?? ""); | ||
window.sessionStorage.setItem("OIDN_NUMBER", process.env.GATSBY_OIDN_NUMBER ?? ""); | ||
|
||
return; // all vars are set in sessionStorage, nothing else to do | ||
} | ||
|
||
const config = getConfig(window.location.hostname); | ||
|
||
if (!config) return; // no config found, nothing else to do | ||
|
||
window.sessionStorage.setItem("API_BASE_URL", config.GATSBY_API_BASE_URL ?? ""); | ||
window.sessionStorage.setItem("NL_DESIGN_THEME_CLASSNAME", config.GATSBY_NL_DESIGN_THEME_CLASSNAME ?? ""); | ||
window.sessionStorage.setItem("FAVICON_URL", config.GATSBY_FAVICON_URL ?? ""); | ||
window.sessionStorage.setItem("ORGANISATION_NAME", config.GATSBY_ORGANISATION_NAME ?? ""); | ||
window.sessionStorage.setItem("JUMBOTRON_IMAGE_URL", config.GATSBY_JUMBOTRON_IMAGE_URL ?? ""); | ||
window.sessionStorage.setItem("FOOTER_LOGO_HREF", config.GATSBY_FOOTER_LOGO_HREF ?? ""); | ||
window.sessionStorage.setItem("FOOTER_CONTENT", config.GATSBY_FOOTER_CONTENT ?? ""); | ||
window.sessionStorage.setItem("FOOTER_CONTENT_HEADER", config.GATSBY_FOOTER_CONTENT_HEADER ?? ""); | ||
window.sessionStorage.setItem("OIDN_NUMBER", config.GATSBY_OIDN_NUMBER ?? ""); | ||
}; | ||
|
||
export const getPathPrefix = (): string => { | ||
const varsAvailable = process.env.GATSBY_ENV_VARS_SET === "true"; | ||
const config = getConfig(window.location.hostname); | ||
|
||
if (varsAvailable && process.env.USE_GITHUB_REPOSITORY_NAME_AS_PATH_PREFIX === "true") { | ||
return `/${process.env.GITHUB_REPOSITORY_NAME}`; | ||
} | ||
|
||
if (config && config.USE_GITHUB_REPOSITORY_NAME_AS_PATH_PREFIX) { | ||
return `/${config.GITHUB_REPOSITORY_NAME}`; | ||
} | ||
|
||
return ""; | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"GITHUB_REPOSITORY_NAME": "woo-website-template", | ||
"USE_GITHUB_REPOSITORY_NAME_AS_PATH_PREFIX": "true", | ||
"GATSBY_API_BASE_URL": "https://api.gateway.commonground.nu/api", | ||
"GATSBY_NL_DESIGN_THEME_CLASSNAME": "conduction-theme", | ||
"GATSBY_FAVICON_URL": "data:image/svg+xml;base64,PD94bW... (truncated for brevity)", | ||
"GATSBY_ORGANISATION_NAME": "Conduction", | ||
"GATSBY_JUMBOTRON_IMAGE_URL": "https://www.conduction.nl/wp-content/uploads/2021/07/cropped-Conduction_HOME_0000_afb1-1.png", | ||
"GATSBY_FOOTER_LOGO_HREF": "https://conduction.nl/", | ||
"GATSBY_FOOTER_CONTENT": "https://raw.githubusercontent.com/ConductionNL/woo-website-template/main/pwa/src/templates/templateParts/footer/FooterContent.json", | ||
"GATSBY_FOOTER_CONTENT_HEADER": "", | ||
"GATSBY_OIDN_NUMBER": "" | ||
} |
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