Add config to enable dummy login on production to use in the demo deploy

This commit is contained in:
Simon Prévost 2019-05-12 21:07:13 -04:00
parent 60b8510485
commit 0f53caa197
5 changed files with 12 additions and 10 deletions

View File

@ -110,6 +110,7 @@ Accent provides a default value for every required environment variable. This me
| `WEBAPP_SENTRY_DSN` | _none_ | The *public* Sentry DSN used to collect Webapp runtime errors |
| `GOOGLE_API_CLIENT_ID` | _none_ | When deploying in a `prod` environment, the Google login is the only way to authenticate user. In `dev` environment, a fake login provider is used so you dont have to setup a Google app. |
| `RESTRICTED_DOMAIN` | _none_ | If specified, only authenticated users from this domain name will be able to create new projects. |
| `DUMMY_LOGIN_ENABLED` | _none_ | If specified, the password-less authentication (with only the email) will be available. |
### Email setup
If you want to send emails, youll have to configure the following environment variables:

View File

@ -6,6 +6,6 @@ config :accent, Accent.Endpoint,
root: ".",
cache_static_manifest: "priv/static/cache_manifest.json"
config :accent, dummy_provider_enabled: false
config :accent, dummy_provider_enabled: System.get_env("DUMMY_LOGIN_ENABLED")
config :logger, level: :info

View File

@ -11,7 +11,7 @@ defmodule Accent.Endpoint do
# You should set gzip to true if you are running phoenix.digest
# when deploying your static files in production.
plug(Plug.Static, at: "/static", from: {:accent, "priv/static"}, gzip: true, only: ~w(jipt images))
plug(Plug.Static, at: "/", from: {:accent, "priv/static/webapp"}, gzip: true, only: ~w(assets index.html))
plug(Plug.Static, at: "/", from: {:accent, "priv/static/webapp"}, gzip: true, only: ~w(favicon.ico assets index.html robot.txt))
# Code reloading can be explicitly enabled under the
# :code_reloader configuration of your endpoint.

BIN
priv/static/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@ -26,7 +26,7 @@ module.exports = function(environment) {
}
};
(ENV.API = {
ENV.API = {
WS_HOST: wsHost,
HOST: host,
AUTHENTICATION_PATH: `${host}/auth`,
@ -39,14 +39,15 @@ module.exports = function(environment) {
JIPT_EXPORT_DOCUMENT: `${host}/jipt-export`,
PERCENTAGE_REVIEWED_BADGE_SVG_PROJECT_PATH: `${host}/{0}/percentage_reviewed_badge.svg`,
JIPT_SCRIPT_PATH: `${host}/static/jipt/index.js`
}),
(ENV.GOOGLE_API = {
CLIENT_ID: process.env.GOOGLE_API_CLIENT_ID
});
};
ENV.GOOGLE_LOGIN_ENABLED =
environment === 'production' || Boolean(process.env.GOOGLE_API_CLIENT_ID);
ENV.DUMMY_LOGIN_ENABLED = !ENV.GOOGLE_LOGIN_ENABLED;
ENV.GOOGLE_API = {
CLIENT_ID: process.env.GOOGLE_API_CLIENT_ID
};
ENV.GOOGLE_LOGIN_ENABLED = Boolean(ENV.GOOGLE_API.CLIENT_ID);
ENV.DUMMY_LOGIN_ENABLED =
Boolean(process.env.DUMMY_LOGIN_ENABLED) || !ENV.GOOGLE_LOGIN_ENABLED;
ENV.SENTRY = {
DSN: process.env.WEBAPP_SENTRY_DSN