Closed sirn closed 6 years ago
Also BASE_URL
handling should properly handle URL with trailing slash and one without. Currently this is causing the URL to be generated as http://www.example.com//path
(double /) in some place while running seeds.
I'm going to rethink a bit about the whole developer experience setting up the eWallet. So I'll separate this into 2 parts:
@sirn Can you find out what Mix.env it's being run on? I'm curious because while :prod
doesn't have a default :base_url
value, :dev
and :test
environment do:
config :ewallet_db,
base_url: System.get_env("BASE_URL") || "http://localhost:4000"
Also... do you think defaulting to https://localhost:4000
should this apply to :prod
as well? In the current code, :prod
environment is the one that does not have a default.
$ echo $MIX_ENV
prod
However, we should probably set this default only for seeds. Since seeds is a one-off script, and we should never assume it will have all environment variables set, especially if the environment variable was only for generating report output. In this case, example.com
is a much better choice.
In other words, let's handle default here for seeds :-)
Subject of the issue
mix seed
shouldn't error if theBASE_URL
wasn't set.Your environment
Steps to reproduce
Leave out
BASE_URL
when runningmix seed
Expected behavior
Seed works with URL fallback to
example.com
or something.Actual behavior
Without
BASE_URL
:With
BASE_URL
: