diff --git a/.env_login b/.env_dev similarity index 58% rename from .env_login rename to .env_dev index 56b421dd..48146744 100644 --- a/.env_login +++ b/.env_dev @@ -6,3 +6,13 @@ export LOGOUT_REDIRECT_EVAL_URL=http://localhost:3000/ export PHOENIX_URI="http://localhost:4000" export LOGIN_SECRET="f4d3c40a00a8e6ed72fae5204d9ddacd40f087865d40803a6fcfb935591a271838533f06081067dac24c0085c74123e7e1c8b3e0ab562c6645b17eb769854d0d" export JWT_SECRET="fc28c5738ca45162f61126e770a8fbdbd938d0fedcfe8fbb9f851b855b0264866364a9130e96aca8b1977e9f58edf064f1aa435ceccf415ff22fd3c24adba320" + +# static pages on localhost +# export PAGES_DOMAIN="localhost:4001" +# export PAGES_HOST="http://localhost:4001" +# export PAGES_BASE_URL="/" + +# static pages on eval-dev branch +export PAGES_DOMAIN="federalist-2c628203-05c2-48ab-8f87-3eda79380559.sites.pages.cloud.gov" +export PAGES_HOST="https://federalist-2c628203-05c2-48ab-8f87-3eda79380559.sites.pages.cloud.gov" +export PAGES_BASE_URL="/preview/gsa/challenges-and-prizes/eval-dev" \ No newline at end of file diff --git a/.envrc b/.envrc index 4fbb075a..ebe455a6 100644 --- a/.envrc +++ b/.envrc @@ -6,4 +6,4 @@ mkdir -p .nix-bundler export BUNDLE_PATH=./.nix-bundler # Login Env Vars -source .env_login +source .env_dev diff --git a/DEVCONFIG.md b/DEVCONFIG.md index c9b2a296..9e03e755 100644 --- a/DEVCONFIG.md +++ b/DEVCONFIG.md @@ -66,7 +66,7 @@ Once direnv is installed and your shell is restarted, clone the project and `cd` ``` ./bin/dev ``` - > _NOTE for login.gov configuration_ -- if you are **not** using direnv/nix to eval `.envrc`, you can run `source .env_login` in your terminal before starting the server or add the env vars in that file to your local environment directly. + > _NOTE for login.gov configuration_ -- if you are **not** using direnv/nix to eval `.envrc`, you can run `source .env_dev` in your terminal before starting the server or add the env vars in that file to your local environment directly. Now you can visit [`localhost:3000`](http://localhost:3000) from your browser. diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb index 9c2f5084..79cb99e9 100644 --- a/app/controllers/pages_controller.rb +++ b/app/controllers/pages_controller.rb @@ -7,13 +7,9 @@ class PagesController < ApplicationController protect_from_forgery except: :assets # TODO: When launched, the cloud.gov pages need to move off the www.challenge.gov domain - # and these constants will need to be updated. The will be similar to the commented out versions - DOMAIN = "federalist-2c628203-05c2-48ab-8f87-3eda79380559.sites.pages.cloud.gov" - HOST = "https://federalist-2c628203-05c2-48ab-8f87-3eda79380559.sites.pages.cloud.gov" - BASE_URL = "/preview/gsa/challenges-and-prizes/eval-dev" - # DOMAIN = "content.challenge.gov".freeze - # HOST = "https://content.challenge.gov".freeze - # BASE_URL = "/".freeze + DOMAIN = Rails.configuration.static_site_interop.fetch(:domain) + HOST = Rails.configuration.static_site_interop.fetch(:host) + BASE_URL = Rails.configuration.static_site_interop.fetch(:base_url) def index path = "#{BASE_URL}/#{params[:path]}/" @@ -58,6 +54,9 @@ def rewrite_links(html) if BASE_URL.length > 1 parsed_html = parsed_html.gsub(BASE_URL, "") end + # delete the data-public-url attribute from the react app element to send requests through rails proxy + parsed_html = parsed_html.sub(/(