diff --git a/README.md b/README.md index e1172d1..48c75bd 100644 --- a/README.md +++ b/README.md @@ -75,3 +75,29 @@ mix local.hex - Uses [ExGuard](https://github.com/slashmili/ex_guard) to run every time a file is changed. - Run `mix guard` to start watching files. - Check out `.exguard.exs` for configuration. + +# Postgres setup +Change password to postgres user +``` +sudo -u user_name psql db_name + +or + +ALTER USER postgres WITH PASSWORD 'new_password'; +``` + +Edit /var/lib/pgsql/data/pg_hba.conf + +``` +local all all trust +``` + +``` +systemctl restart postgresql +``` + +# Issues encountered + +- Building the client files fails with not enough ram +- It runs out of ram on a Centos vps so I needed to add more swap space +- https://www.digitalocean.com/community/tutorials/how-to-add-swap-on-centos-7 diff --git a/client/app/util/oauth/oauth.ts b/client/app/util/oauth/oauth.ts index 8378c78..82a3f59 100644 --- a/client/app/util/oauth/oauth.ts +++ b/client/app/util/oauth/oauth.ts @@ -1,8 +1,36 @@ -// TODO: add prod url -const oauthUrl: string = - process.env.NODE_ENV === 'production' - ? '' - : 'https://us.battle.net/oauth/authorize?redirect_uri=https://localhost/oauth&scope=wow.profile&client_id=2pfsnmd57svcpr5c93k7zb5zrug29xvp&response_type=code'; +// for prod site +// TODO: +const prod_id = ''; +const prod_redirect_uri = 'https://dev.classicwowforums.com/oauth'; + +// for dev site +const dev_id = 'dy22zpswn6b5q22zjparrcn83jkdre9h'; +const dev_redirect_uri = 'https://dev.classicwowforums.com/oauth'; + +// for local site +const local_id = 'h8fx6ad624ne9qw2njxx6343za7fux3j'; +const local_redirect_uri = 'https://localhost/oauth'; + +let client_id; +let redirect_uri; + +switch (process.env.NODE_ENV) { + case 'production': + client_id = prod_id; + redirect_uri = prod_redirect_uri; + break; + case 'dev': + client_id = dev_id; + redirect_uri = dev_redirect_uri; + break; + default: + client_id = local_id; + redirect_uri = local_redirect_uri; +} + +// TODO: support for eu etc. +const oauthUrl = + `https://us.battle.net/oauth/authorize?redirect_uri=${redirect_uri}&scope=wow.profile&client_id=${client_id}&response_type=code`; const openOuathWindow = () => { window.open(oauthUrl, '_blank', 'resizeable=yes, height=900, width=1200'); diff --git a/client/package.json b/client/package.json index 7895b5a..8d5f831 100644 --- a/client/package.json +++ b/client/package.json @@ -3,7 +3,9 @@ "version": "1.0.0", "description": "A seed for a simple react application with typescript.", "scripts": { - "build": "NODE_ENV=production webpack -p --progress --colors", + "build": "webpack -p --progress --colors", + "build:dev": "NODE_ENV=dev webpack -p --progress --colors", + "build:prod": "NODE_ENV=production webpack -p --progress --colors", "dev": "webpack --progress --colors --watch", "c9": "webpack-dev-server --host 0.0.0.0 --port 8080 --inline --history-api-fallback", "start": "webpack-dev-server --inline --history-api-fallback",