Skip to content
Elixir library for reading Java properties files from various sources.
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.


Type Name Latest commit message Commit time
Failed to load latest commit information.


Build Status

Exjprop is a library for reading Java properties files from various sources.

Implementations are provided for File, Stream, Function (which returns a stream), and Amazon S3.

API documentation is available at

Add as dependency

{:exjprop, "~> 1.2"}

Load application properties at runtime

First, define a property loader module

defmodule MyApp.PropLoader do
  use Exjprop.Loader
  import Exjprop.Validators, only: [required: 1]

  property "endpoint.secret", {:my_app, MyApp.Endpoint, :secret_key_base}

  property "", {:my_app, MyApp.Foo, :bar}, secret: false, pipeline: [&required/1]
  property "foo.quux", {:my_app, MyApp.Foo, :quux}, secret: false, pipeline: [&required/1, &integer/1]

  property "other_app.thing", {:other_app, :thing}, secret: false, pipeline: [&required/1, &integer/1]

Next, when your application starts, have it read in your properties and update your application environment

defmodule MyApp do
  use Application
  import Supervisor.Spec
  alias MyApp.PropLoader

  def start(_type, _args) do
    PropLoader.load_and_update_env({:system, "MYAPP_PROPS_FILE"})

This configuration will cause the prop loader to read the MYAPP_PROPS_FILE environment var, and attempt to use that as a uri for loading a properties file. The uri should either file:///path/to/ or s3:///myapp_bucket/path/to/s3/

Using S3 URLs

To enable support for retrieving property files from S3, a few additional dependencies are required.

  {:ex_aws, "~> 2.1"},
  {:sweet_xml, "~> 0.6"},

ExAws also needs an HTTP client - it defaults to Hackney, but can be modified (see


Enable validators for json to keyword lists or maps

  {:jason, "~> 1.1.2"},
You can’t perform that action at this time.