coen.bakker
I am currently using Ueberauth to allow users to use third-parties to authenticate themselves. I can make the *_CLIENT_ID and *_CLIENT_SECRET available in my dev/test env with, for example:
export GOOGE_CLIENT_ID = "..."
export GOOGLE_CLIENT_ID = "..."
But how can I prevent having to export the variables with each new shell session?
Maybe I have taken a wrong approach to setting the env variables altogether? What is the recommended way to make them available to a dev/test environment?
Trending in Questions
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
Hello,
I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
Documentation
While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New
Other Trending Topics
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Hi everyone!
The first release candidate for the Expert language server project is now available!
We’ve published a press release detai...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #ai
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #hex
- #security











Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
coen.bakker
Is it common to add a shell script somewhere? I see that Fly.io generated an
env.sh.eexto export some variables. Should I do the same? Not sure how to run that before each compile, however…sodapopcan
For development, the answer is probably to use direnv.
Personally, I just make myself a shell script in the root directory that I call
devthat has the following as a bare minimum.Then just
./devto start the dev server.For production is dependent on how you deploy, of course.
coen.bakker
This is great. Thank you.
For production I use Fly.io. You can set “secrets” with their cli and on their website.
D4no0
Or you can create an additional config file that you will add to gitignore and import from
dev.exsortest.exs.coen.bakker
Is that was dev.secrets.exs was/is?
D4no0
I mean there is no convention, but yeah, I’ve seen this used in a few projects.
coen.bakker
I’ve seen it around also.
I got the impression that it used to be generated in Phoenix apps in a previous version of the phx generator. See for example here: https://stackoverflow.com/q/68239156.
But thanks again.
pdgonzalez872
My 2c: I tent to prefer explicitness for env vars, rather than having things magically get loaded. I’ve seen and used this mechanism before:
direnvworks well, but assumes folks have it set up (most do). The above is more explicit in my opinion. I don’t mind the verbosity, mostly due to me rarely having to type that out (always on a readme or in a shell history somewhere).When working with others, there is usually something on the readme that will help (including yourself when you forget
) As far as the mechanics:
.env.examplethat is committed to the repo (example).envfile in.gitignore(example).envfile in the readme (example)If you don’t have a lot of env vars, I’d start with
SOME_VAR=your_var mix phx.serverand build from that. Then, consider the above if that sounds interesting.sodapopcan
I don’t know why I never thought of this—it seems so obvious, lol.
The dev script still comes in handy, at least for one project, where I need to start up multiple nodes. Of course, Docker is probably the “real” answer there, but I’m stubborn. Maybe there is another way? Though this is getting a little off topic of purely ENV vars.
arcanemachine
I use (and love)
direnv, but for working with others, I find that dotenvy is a good solution with less friction thandirenv.It’s another dependency, but it gets rolled in with the others when you run
mix deps.get. Plus it works in all environments, instead of only ones wheredirenvis installed (CI, shared dev boxes, etc.).I’ve encountered the custom
config.exsstrategy mentioned by @D4no0, and I’m not a fan of the concept. Dotenv files are closer to a “universal” configuration system, so that’s a big plus for me. It allows me to share a config system between my Elixir project, my Docker Compose config, etc.