mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-24 17:35:16 +00:00
Update react to use .env
This commit is contained in:
parent
feb2ac37da
commit
86549d3335
17
README.md
17
README.md
@ -6,30 +6,31 @@ Stack: Go 1.16+, Node 15+, React 17+, MySQL 8.0+, Redis
|
|||||||
|
|
||||||
There are prebuilt binaries/packages available.
|
There are prebuilt binaries/packages available.
|
||||||
|
|
||||||
|
|
||||||
Copy .env.example to .env and set variables. You can use https://www.grc.com/passwords.htm to generate a JWT_SECRET.
|
Copy .env.example to .env and set variables. You can use https://www.grc.com/passwords.htm to generate a JWT_SECRET.
|
||||||
|
|
||||||
|
## More documentation
|
||||||
|
[Environment Variables](docs/config.md)
|
||||||
|
|
||||||
## Setup MySQL
|
## Setup MySQL
|
||||||
create user 'goscrobble'@'%' identified by 'supersecurepass';
|
create user 'goscrobble'@'%' identified by 'supersecurepass';
|
||||||
create database goscrobble;
|
create database goscrobble;
|
||||||
grant all privileges on goscrobble.* to 'goscrobble'@'%';
|
grant all privileges on goscrobble.* to 'goscrobble'@'%';
|
||||||
|
|
||||||
## Local build/run
|
## Local Development
|
||||||
cp .env.example .env # Fill in the blanks
|
cp .env.example .env # Fill in the blanks
|
||||||
cd web && npm install && REACT_APP_API_URL=http://127.0.0.1:42069 npm start
|
|
||||||
# In another terminal
|
|
||||||
go mod tidy
|
go mod tidy
|
||||||
CGO_ENABLED=0 go run cmd/go-scrobble/*.go
|
CGO_ENABLED=0 go run cmd/go-scrobble/*.go
|
||||||
|
# In another terminal set web/.env.development
|
||||||
|
cd web && npm install && npm start --env development
|
||||||
|
|
||||||
|
|
||||||
Access dev frontend @ http://127.0.0.1:3000 + API @ http://127.0.0.1:42069/api/v1
|
Access dev frontend @ http://127.0.0.1:3000 + API @ http://127.0.0.1:42069/api/v1
|
||||||
|
|
||||||
## Run local tests
|
|
||||||
go test test/*
|
|
||||||
|
|
||||||
## Prod deployment
|
## Prod deployment
|
||||||
We need to build NPM package, and then ship web/build with the binary.
|
We need to build NPM package, and then ship web/build with the binary.
|
||||||
|
|
||||||
cp .env.example .env # Fill in the blanks
|
cp .env.example .env # Fill in the blanks
|
||||||
cd web npm install --production && REACT_APP_API_URL=https://goscrobble.com npm run build
|
cd web npm install --production && npm run build --env production
|
||||||
go build -o goscrobble cmd/go-scrobble/*.go
|
go build -o goscrobble cmd/go-scrobble/*.go
|
||||||
./goscrobble
|
./goscrobble
|
||||||
|
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
## FRONTEND VARS
|
## FRONTEND VARS
|
||||||
|
These are stored in `web/.env.production` and `web/.env.development`
|
||||||
|
|
||||||
REACT_APP_REGISTRATION_DISABLED=true // Disables registration
|
REACT_APP_REGISTRATION_DISABLED=true // Disables registration
|
||||||
REACT_APP_API_URL=https://goscrobble.com // Sets API URL
|
REACT_APP_API_URL=https://goscrobble.com // Sets API URL
|
||||||
|
|
||||||
@ -18,4 +20,4 @@
|
|||||||
JWT_EXPIRY=86400 // JWT expiry
|
JWT_EXPIRY=86400 // JWT expiry
|
||||||
|
|
||||||
REVERSE_PROXIES=127.0.0.1 // Comma separated list of servers to ignore for IP logs
|
REVERSE_PROXIES=127.0.0.1 // Comma separated list of servers to ignore for IP logs
|
||||||
PORT=42069 // Server port
|
PORT=42069 // Server port
|
||||||
|
2
web/.env.development
Normal file
2
web/.env.development
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
REACT_APP_API_URL=http://127.0.0.1:42069
|
||||||
|
REACT_APP_REGISTRATION_DISABLED=false
|
2
web/.env.production
Normal file
2
web/.env.production
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
REACT_APP_API_URL=https://goscrobble.com
|
||||||
|
REACT_APP_REGISTRATION_DISABLED=true
|
Loading…
Reference in New Issue
Block a user