mxst
How to add a config file to a livebook?
Hello everyone,
I’m trying to add a secret to my livebook. ( I need to have some credentials but I don’t want to save them in the livebook directy)
I tried the following in the ‘Notebook dependencies and setup’
Mix.install([
{:req, "~> 0.2.1"},
{:jason, "~> 1.3"},
{:kino, "~> 0.5.0"}
],
config_path: "<full_path>/config/config.exs"
)
but if I now try to access the config via Application.get_all_env(:apaleo_api) the return is empty.
config.exs:
import Config
config :apaleo_api, :basic_auth,
username: "username",
password: "password"
Maybe someone can tell me what I am doing wrong …
Most Liked
mxst
I think I found a solution with:
Mix.install([
{:req, "~> 0.2.1"},
{:jason, "~> 1.3"},
{:kino, "~> 0.5.0"}
],
config: Config.Reader.read!("#{__DIR__}/config/config.exs")
)
2
w0rd-driven
That’s the preferred approach according to the docs: Mix — Mix v1.14.0. There’s also a :config_path option as of the newest Elixir 1.14 that loads the file for you as well as a paired runtime.exs if it’s in the same directory.
1
Popular in Questions
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service.
Currently when I de...
New
After calling mix ecto.create I get this error:
17:00:32.162 [error] GenServer #PID<0.412.0> terminating
** (Postgrex.Error) FATAL...
New
i’m a new one to elixir
which editor can i use
vs code? or atom?
Thanks! :smiley:
New
In Ruby, I can go:
User.find_by(email: "foobar@email.com").update(email: "hello@email.com")
How can I do something similar in Elixir? ...
New
Credo is smart enough to check for (something like) this:
assert length(the_list) == 0
with this response:
Checking if an enum is empt...
New
Hi, I’m using Ubuntu 18.04 and after updating to OTP-24.0 yesterday i have this warning when I run “mix local.hex”:
14:57:30.512 [warn] ...
New
What is most correct way to open, read and parse JSON file with poison?
For example if we have example.json file in root of some projec...
New
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
Sometimes I want to check if the input into a function is not a blank string.
My first approach:
defmodule Example do
def do_stuff(s...
New
I am constructing a JSON object (map) and I need to conditionally set a field. I’m trying to write proper elixir-way code… and I’m at a l...
New
Other popular topics
In Ruby, I can go:
User.find_by(email: "foobar@email.com").update(email: "hello@email.com")
How can I do something similar in Elixir? ...
New
Okay, I'm having a heck of a time trying to figure out how to best handle the validation of belongs_to associations in Ecto. I'm sure I'...
New
can someone please explain to me how Enum.reduce works with maps
New
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
New
I want to try my hand at web scraping. What tools/libraries do I need to use. I’m hoping to turn this into something professional so don’...
New
Elixir plugin for JetBrain’s IntelliJ Platform (including Rubymine)
This is a plugin that adds support for Elixir to JetBrains IntelliJ...
New
As many of you may have realized by now (sorry for all the posts here) I’ve been working on a db problem where I’m trying to aggregate a ...
New
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New







