From cf7f5d0f16b98aca01844c7458336e6ed9e5323f Mon Sep 17 00:00:00 2001 From: Benjamin ter Kuile Date: Fri, 30 Apr 2021 15:22:16 -0500 Subject: [PATCH] updates for new development env --- app/controllers/application_controller.rb | 11 ++++++++--- app/controllers/supplier_controller.rb | 2 +- app/helpers/application_helper.rb | 2 +- app/views/dashboard/demo_both.html.slim | 2 +- config/initializers/mozo_settings.rb | 2 +- config/initializers/omniauth.rb | 2 +- faye/Dockerfile | 1 - faye/rebuild-docker.sh | 2 ++ 8 files changed, 15 insertions(+), 9 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index c6c82650..a96aa9b5 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -137,14 +137,19 @@ private def json_response(obj, options = {}) if obj.is_a?(SimplyStored::Couch) if obj.errors.present? - json_api_errors = obj.errors.details.map{|key, ers| {id: key, status: '422', title: ers.map{|e| e[:error].to_s}.join(', '), source: {parameter: key}}} + #json_api_errors = obj.errors.details.map{|key, ers| {id: key, status: '422', title: ers.map{|e| e[:error].to_s}.join(', '), source: {parameter: key}}} + json_api_errors = obj.errors.map{|error| {id: error.attribute, status: '422', title: error.message}} options.reverse_merge(json: {errors: json_api_errors, ok: false}, status: :unprocessable_entity) else options.reverse_merge(json: obj) end else # assume crude Hash - obj[:ok] = true unless obj.has_key?(:ok) - obj + if obj[:errors] + obj + else + obj[:ok] = true unless obj.has_key?(:ok) + obj + end end end diff --git a/app/controllers/supplier_controller.rb b/app/controllers/supplier_controller.rb index 4c3c2376..a17d86a9 100644 --- a/app/controllers/supplier_controller.rb +++ b/app/controllers/supplier_controller.rb @@ -1,7 +1,7 @@ class SupplierController < Suppliers::ApplicationController def home if Rails.env.development? - redirect_to "https://supplier.mozo.local/supplier/#{params[:other]}" + redirect_to "https://localhost:4202/supplier/#{params[:other]}" else redirect_to "https://supplier.mozo.bar/supplier/#{params[:other]}" end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 0fadd590..d008ddfb 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -7,7 +7,7 @@ module ApplicationHelper def user_root_path case Rails.env - when 'development' then 'https://user.mozo.local/' + when 'development' then 'https://localhost:4201/' else 'https://user.mozo.bar/' end end diff --git a/app/views/dashboard/demo_both.html.slim b/app/views/dashboard/demo_both.html.slim index 94056a30..33daa855 100644 --- a/app/views/dashboard/demo_both.html.slim +++ b/app/views/dashboard/demo_both.html.slim @@ -3,6 +3,6 @@ iframe.phone-content-frame src=user_root_path .tablet-wrapper - if Rails.env.development? - iframe.tablet-content-frame src="https://supplier.mozo.local/supplier/" + iframe.tablet-content-frame src="https://localhost:4202/supplier/" - else iframe.tablet-content-frame src="https://supplier.mozo.bar/supplier/" diff --git a/config/initializers/mozo_settings.rb b/config/initializers/mozo_settings.rb index f8833ea4..e3fe9edb 100644 --- a/config/initializers/mozo_settings.rb +++ b/config/initializers/mozo_settings.rb @@ -1,5 +1,5 @@ if Rails.env.development? - Qwaiter.event_host = "https://events.mozo.local:9296/faye" + Qwaiter.event_host = "https://localhost:9296/faye" else Qwaiter.event_host = "https://events.mozo.bar:9296/faye" end diff --git a/config/initializers/omniauth.rb b/config/initializers/omniauth.rb index 513216ae..6c8ade45 100644 --- a/config/initializers/omniauth.rb +++ b/config/initializers/omniauth.rb @@ -1,2 +1,2 @@ -OmniAuth.config.full_host = Rails.env.production? ? 'https://www.mozo.bar' : 'https://www.mozo.local' +OmniAuth.config.full_host = Rails.env.production? ? 'https://www.mozo.bar' : 'https://localhost:3002' diff --git a/faye/Dockerfile b/faye/Dockerfile index 7f412f97..f342ea4e 100644 --- a/faye/Dockerfile +++ b/faye/Dockerfile @@ -39,4 +39,3 @@ EXPOSE $FAYE_PORT #CMD thin start -R config.ru -p $FAYE_PORT CMD thin start -R config.ru -p $FAYE_PORT --ssl --ssl-key-file=ssl/privkey.pem --ssl-cert-file=ssl/fullchain.pem - diff --git a/faye/rebuild-docker.sh b/faye/rebuild-docker.sh index 3544979f..e64ed3fe 100755 --- a/faye/rebuild-docker.sh +++ b/faye/rebuild-docker.sh @@ -47,8 +47,10 @@ docker build -f faye/Dockerfile -t mozo_faye . # 5. Spin up the counter container from the generated image if [ $arch == "Darwin" ]; then + echo "Running the created image using the Mac Darwin port exposing" docker run -p 9296:9296 --restart unless-stopped --detach --name=mozo_faye mozo_faye else + echo "Running the created image using network=host" docker run --network=host --restart unless-stopped --detach --name=mozo_faye mozo_faye fi