I have a config.exs file in my config/
directory, located at the project root:
import Config
config :iex, default_prompt: ">>>"
config :my_app,
key1: “value1”
import_config “#{Mix.env()}.exs”
When I start my app via shell iex -S mix
, not only can I not read my key1
variable, but the default prompt has not changed. This tells me that the app is not reading my config file.
Just for context, this is the structure of my project directory:
~/
lib/
config/
config.exs
application.ex
This is my application file:
defmodule My.Application do
@moduledoc "Application file"
use Application
def start(_type, _args) do
children = [
Plug.Cowboy.child_spec(
scheme: :http,
plug: My.Web.Endpoint,
options: [port: 8000]
)
]
opts = [strategy: :one_for_one, name: Blog.Supervisor]
IO.puts("Starting...")
Supervisor.start_link(children, opts) |> IO.inspect
end
end
and my mix file:
defmodule My.MixProject do
use Mix.Project
def project do
[
app: :my_app,
version: "0.1.0",
elixir: "~> 1.10",
start_permanent: Mix.env() == :prod,
deps: deps()
]
end
# Run "mix help compile.app" to learn about applications.
def application do
[
extra_applications: [:logger],
mod: {My.Application, []}
]
end
# Run "mix help deps" to learn about dependencies.
defp deps do
[
{ :plug_cowboy, "~> 2.0" }
]
end
end
What am I doing wrong?