Added local dev env configuration

- call init by default if there's an env var for ADMIN_URL
- add an example local dev config
This commit is contained in:
Hannah Wolfe 2020-04-10 17:37:40 +01:00
parent e9a193445d
commit c3d13f2451
3 changed files with 18 additions and 4 deletions

View File

@ -0,0 +1,2 @@
REACT_APP_ADMIN_URL=http://localhost:2368/ghost
REACT_APP_SITE_URL=http://localhost:2368

View File

@ -1,7 +1,13 @@
# Membersjs
# Members.js
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
## Configure for local development
- Copy `.env.local.example` to `.env.local`
- Update the values to match your local dev version of Ghost
- Ensure your local Ghost is running
## Available Scripts
In the project directory, you can run:

View File

@ -12,9 +12,15 @@ function initMembersJS(data) {
);
}
// Uncomment for local UI testing
// initMembersJS({site: {siteUrl: "", adminUrl: ""}});
window.GhostMembers = {
initMembersJS: initMembersJS
};
// This will automatically load for local if an .env.local file is present
if (process.env.REACT_APP_ADMIN_URL) {
let site = {
adminUrl: process.env.REACT_APP_ADMIN_URL,
siteUrl: process.env.REACT_APP_SITE_URL || process.env.REACT_APP_ADMIN_URL
};
initMembersJS({site});
}