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 asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
Good day to you all.
I have been struggling to get a query involving like and ilike to work.
Can anyone assist me on this, please?
pro...
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
Hey all, just started picking up Elixir last week and am writing a scraper as a learning project.
Baby step #1 is extracting the number ...
New
I’m currently trying to understand how to join three tables using Ecto. All the examples I’ve seen use 2, so maybe I’m just missing somet...
New
Hello, I have map which I want to convert it to string like this:
the map:
%{last_name: "tavakkoli", name: "shahryar"}
the string I ne...
New
Hello everybody,
usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
Hi all
I want to have a unix time, from the current time plus 1 hour.
DateTime.now + 1 hour
How to get it in elixir?
Thanks
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
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
Other popular topics
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
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this:
...
New
I have an umbrella app.
Some of the apps inside depend on other apps in the umbrella, unsurprisingly.
I'm writing a test for one of t...
New
i’m a new one to elixir
which editor can i use
vs code? or atom?
Thanks! :smiley:
New
As a follow up to my earlier question:
I have the code compiling and running but not getting a successful login from the rest server. ...
New
This release brings a number of exciting features, including integration with the new Phoenix LiveDashboard and Phoenix LiveView. There h...
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
I would like to know what is the best IDE for elixir development?
New
Hello everybody,
usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
Hi all,
I've just started learning Elixir and Phoenix Framework, so please pardon my n00bness at this stage.
I'm trying to use Postg...
New







