Fixed docker env bugs, and issues from PR

This commit is contained in:
Nedim Uka
2018-07-26 13:47:59 +02:00
parent 1f6b1043a4
commit 5c07b371a0
6 changed files with 21 additions and 17 deletions

View File

@@ -55,6 +55,9 @@ define('SECURE_AUTH_SALT', 'Ku5k]% pS[eN,))rR4%JF7c5l;w(NVFvLir-:|-N07`[yp/U*J2x
define('LOGGED_IN_SALT', 'AS,kWNt-W~}c(# tsmi$hEx{XD|`<vXO{hT$|0KPLt$z!`6x>J28>nf~*8jsfFkc');
define('NONCE_SALT', '5}W)&1O:bSk@p=Uj1QJIuT<91:LHv+`Ix=;y37LaPwNWa&EW$;E~jU45+.-;%]2}');
define('JWT_AUTH_SECRET_KEY', 'z={bYHD+B[NE>o${e:t~LZ]b!2n8knYwjAsRzB5`|8IM-#d/kv+#V-1900e1ia2M');
define('JWT_AUTH_CORS_ENABLE', true);
//For case when wordpress is behind reverse proxy https -> http
//With this settings, siteurl and home have to be https://....

View File

@@ -20,13 +20,12 @@ services:
context: .
dockerfile: frontend.dockerfile
args:
- REACT_APP_TEST_URL
- REACT_APP_PROD_URL
- REACT_APP_DEV_URL
- API_URL
volumes:
- ./log/frontend/:/var/log/apache2/
ports:
- '8080:80'
db:
build:

View File

@@ -1,12 +1,15 @@
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /api/
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /api/index.php [L]
RewriteRule . /index.php [L]
RewriteCond %{HTTP:Authorization} ^(.*)
RewriteRule ^(.*) - [E=HTTP_AUTHORIZATION:%1]
</IfModule>
SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
# END WordPress
# END WordPress

View File

@@ -1,12 +1,14 @@
FROM php:7.0-apache
ARG API_URL
ENV REACT_APP_API_URL=${API_URL}
ARG REACT_APP_TEST_URL
ARG REACT_APP_PROD_URL
ARG REACT_APP_DEV_URL
ENV REACT_APP_TEST_URL ${REACT_APP_TEST_URL}
ENV REACT_APP_PROD_URL ${REACT_APP_PROD_URL}}
ENV REACT_APP_DEV_URL ${REACT_APP_DEV_URL}
ENV REACT_APP_TEST_URL ${API_URL}
ENV REACT_APP_PROD_URL ${APIP_URL}
ENV REACT_APP_DEV_URL ${API_URL}
RUN apt-get update && apt-get install -y git unzip gnupg
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash -

View File

@@ -38,17 +38,14 @@ export const validateAccessToken = (token) => {
return dispatch => {
dispatch(validateToken());
return htmlClient.fetch({
url: `http://localhost//wp-json/jwt-auth/v1/token/validate`,
url: `${API_SERVER}/wp-json/jwt-auth/v1/token/validate`,
method: 'post'
})
.then(response => {
if (response.data && response.data.status === 200) {
if (response.data && response.data.data.status === 200) {
// TODO: Implement refresh logic on backend as it was on old wias , or find a nother way
// to handle token validation another way
// const serverTime = response.data.serverTime || 1;
dispatch(loggedIn({
@@ -77,7 +74,7 @@ export const validateCredentials = (username, password) => {
dispatch(login());
return htmlClient.fetch({
url: `http://localhost/wp-json/jwt-auth/v1/token`,
url: `${API_SERVER}/wp-json/jwt-auth/v1/token`,
method: 'post',
data: {
"username": username,

View File

@@ -16,6 +16,6 @@ const API_SERVER_BASE = (() => {
return process.env.REACT_APP_DEV_URL;
})();
const API_SERVER = API_SERVER_BASE + '/' + API_VERSION;
const API_SERVER = API_SERVER_BASE
export {APPLICAITON_MODE, API_SERVER_BASE, API_SERVER, APPLICATION_NAME}