calebjosue

calebjosue

Hello there all,

In Python you can store API Keys in a .env file, you can use this information by retrieving it with the help of environ for example.

What’s the best way to do this in a Phoenix web application?

Thanks!

Showing Posts 1 to 6

AndyL

AndyL

Now that I use LLM tools doing GodKnowsWhat on my dev box, I no longer trust keys stored in plain text. I’m looking for a secure way to store API Keys on disk and maybe even checked into git.

https://getsops.io/ looks interesting. Any other solutions?

calebjosue

calebjosue OP

Thanks!

I think I’ll take a look at the following URL

While my website is a static site disguised as a Phoenix web application, therefore I did not take an in-depth look to this section some years ago.

ibarch

ibarch

You might like fnox to store secrets in dev environment. For production apps running as a systemd service, use the built-in systemd-creds mechanism.

christhekeele

christhekeele

The easiest way to do this in any application is to:

  1. Install a dotenv cli [1], [2]
  2. Populate your .env file
  3. Run the application through the dotenv cli to apply environment variables, ex:
    dotenvx run -– mix phx.server
  4. Access the environment variables as idiomatic to your application’s language
phcurado

phcurado

for dev environment, I usually use sops as mentioned here on the thread. It removes the need for .env files and you don’t need to pass them around to your team or worry about .gitignore them.
When you load the sops secrets, they come out as envs in your terminal so you can use System.get_env/2 in your config/runtime files. I wrote about sops last year in my blog in case you want to see how I use it.
It’s possible to extend this configuration using infrastructure secrets (like KMS) but local secrets with age works well too.

lud

lud

I’ve built nvir to load .env files locally in a simple way. Of course this is only for dev/test environment. In production you just set the secrets as “real” environment variables.

— All posts loaded —

Where Next? Top

Trending in Questions Top

RSP87
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
nseaSeb
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
RemyXRenard
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
velrest
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
samoloth
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
brecabral
Documentation While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
FlyingNoodle
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 Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
marciok
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
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
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
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
webofbits
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself. My main conc...
#ai
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews