Welcome to my little node on the network! My name is Petar and you can follow along while I try to figure out how computers work.

Recent notes

Local config for Phoenix

Here’s a handy tip: create Phoenix configurations that live only on your machine, not in version control.

I use this for setting machine-specific domain names. It’s ideal for any development settings that shouldn’t live in your shared repository.

First, add this snippet at the bottom of config.exs:

if File.exists?("#{__DIR__}/#{config_env()}.local.exs") do
  import_config "#{config_env()}.local.exs"
end

Create a file named dev.local.exs and Phoenix will load it. Add this to your .gitignore to keep it local:

# Ignore local environment configs
*.local.exs

Your machine-specific settings won’t touch production or bother teammates. Common uses:

  • Local database credentials
  • Custom domain names (like dev.localhost)
  • Local service endpoints
  • Personal log levels

Everyone on your team can customize their environment without stepping on each other’s toes. Enjoy!

Permalink

Recent Posts

Running to think

For a few years now, I've been partaking in the age-old ritual of running. I began my journey like many others, swathed in quality athletic wear and armed with a meticulous training schedule...

Read more

Recent reads