dotenv config

main
Cameron Clough 2022-01-10 02:13:00 +00:00
parent 0e6b7c7d3a
commit 06c7cd01b3
6 changed files with 32 additions and 1 deletions

4
.env.development 100644
View File

@ -0,0 +1,4 @@
PUBLIC_URL=http://localhost:3000
API_URL=http://localhost:8080
REACT_APP_WEBSITE_NAME="RetroPilot Connect - Development"

4
.env.production 100644
View File

@ -0,0 +1,4 @@
PUBLIC_URL=https://connect.retropilot.org
API_URL=https://api.retropilot.org
REACT_APP_WEBSITE_NAME="RetroPilot Connect"

1
.env.test 120000
View File

@ -0,0 +1 @@
.env.development

View File

@ -3,3 +3,7 @@ React client for Retropilot
Ties into https://github.com/retropilot/retropilot-server/ to provide a react frontend
To override the environment variables, create a `.env.local` file. You can also override the
variables for development, testing and production independently (`.env.development`,
`.env.test.local` and `.env.production.local` files).

View File

@ -24,7 +24,7 @@
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>RetroPilot Client</title>
<title>%REACT_APP_WEBSITE_NAME%</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>

18
src/config.js 100644
View File

@ -0,0 +1,18 @@
const config = {
/**
* The address at which the website is hosted.
*/
publicUrl: process.env.PUBLIC_URL,
/**
* The address at which the API is accessible.
*/
apiUrl: process.env.API_URL,
/**
* The name displayed in the website title.
*/
websiteName: process.env.REACT_APP_WEBSITE_NAME,
};
export default config;