bgoosman
Notebook global variable
I’d like to define an s3 bucket name as a global in my livebook. I guess I could use a notebook secret for that, but it’s not really a secret, more like an environment variable. How would you solve this?
Marked As Solved
jonatanklosko
Creator of Livebook
Secret sounds good, it doesn’t need to be a secret value per se. In the settings you can also define global environment variables.
1
Also Liked
jonatanklosko
Creator of Livebook
I wonder if it can be used for this use case too?
My understanding is that you want a value shared across notebooks, so a secret/env makes sense. Otherwise you can just define a variable in the setup cell, or at the top.
As for Mix.install, in case of runtime config I usually prefer this:
Mix.install([
{:req, "~> 0.5.6"},
{:kino, "~> 0.14.0"},
{:ex_aws, "~> 2.1"},
{:ex_aws_s3, "~> 2.0"},
{:hackney, "~> 1.9"},
{:sweet_xml, "~> 0.6"},
{:cachex, "~> 4.0"},
{:exjsx, "~> 4.0"},
{:kino_slack, "~> 0.1.1"}
])
Application.put_env(:ex_aws,
debug_requests: true,
json_codec: Jason,
access_key_id: {:system, "LB_AWS_ACCESS_KEY_ID"},
secret_access_key: {:system, "LB_AWS_SECRET_ACCESS_KEY"},
s3: [
scheme: "https://",
host: "fly.storage.tigris.dev",
region: "auto"
]
)
The advantages is that changing config in this way doesn’t invalidate the Mix.install cache.
3
Popular in Questions
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
Is there a way to get the call stack or stack trace at any point in the code? Not from exceptions, but an expression that returns how the...
New
To my knowledge, put_in, Map.update etc. all have the one limitation of not automatically creating intermediate keys when needed (for exa...
New
ExUnit now has describe blocks which is a welcome addition coming from RSpec. In the docs, it states that nested hierarchies of describe ...
New
The Elixir Typespec docs show the following syntax for keyword lists in typespecs:
# ...
| [key: type] # keyword lis...
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
If I have a string “1000 cfu/ml” . I want to remove the characters and / and space . So the string is like this
"1000"
What is the ...
New
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
What is the proper way to load a module from a file in to IEX?
In the python world, doing something like this pretty standard:
from ....
New
Other popular topics
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
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
Hi everyone,
One of the features added to Elixir early on to help integration with Erlang code was the idea of overridable function defi...
New
Hey,
Just curious what are the main benefits of Elixir compared to Clojure?
When is Elixir more useful than Clojure and vice versa?
Th...
New
Original source of discussion: This topic on the Pragmatic Programmers' Functional Web Development with Elixir, OTP, and Phoenix forum.
...
New
Hello everyone,
Long time lurker first time poster here. I’ve recently begun working on Elixir full-time again! :raised_hands: It’s been...
New
i’m a new one to elixir
which editor can i use
vs code? or atom?
Thanks! :smiley:
New
Got a question about when to concat vs. prepending items to list then reversing to achieve appending.
So i know lists boil down to [1 | ...
New
What is the proper way to load a module from a file in to IEX?
In the python world, doing something like this pretty standard:
from ....
New
Update:
How to use the Blogs & Podcasts section
You can post links to your blog posts or podcasts either in one of the Official Blog...
New







