At Elixir Meetup #2, Łukasz Niemier delivered an enlightening presentation on the complexities of configuring Elixir applications.

Table of contents

    Contrary to popular belief, configuring Elixir applications is not as straightforward as it seems. Łukasz provided an in-depth look at various configuration methods, their pitfalls, and best practices.

    About Łukasz Niemier

    Łukasz Niemier is an Elixir and Erlang developer passionate about observability and cryptography. With over five years of experience writing Elixir, he is a member of the Erlang Ecosystem Foundation Observability Working Group and the author of the blog.

    Configuration in Elixir: An Overview

    The Misconception of Simplicity

    Łukasz began by addressing the common misconception that Elixir configuration is simple. He highlighted the multiple places where configuration can be set, each with its own implications and complexities.

    Key Points:

    Mix Application Callback: Rarely used in Elixir, more common in Erlang. Config.exs: The traditional method, evaluated at compile time. Runtime.exs: Added in Elixir 1.10, handles runtime configuration. Releases.exs: Deprecated, used for runtime configuration in releases. Environment Variables: Passed directly at runtime, often overriding other configurations.

    Understanding Configuration Times

    Four Key Phases

    Łukasz explained the four key phases when configuration is applied: compile time, build time, launch time, and runtime. Each phase impacts the configuration in different ways, making it crucial to understand their implications.


    Compile Time: Configuration applied during compilation. Build Time: Configuration applied during the build process. Launch Time: Configuration applied when the application starts. Runtime: Configuration checked and applied during execution.

    The Intricacies of Config.exs

    Deep Merging and Overriding

    Łukasz detailed the intricacies of using config.exs, including how Elixir merges and overrides configurations. He emphasized that while Elixir allows deep merging, Erlang sees configuration as flat, leading to potential conflicts and unexpected behavior.

    Key Concepts:

    Deep Merging: Combining nested configurations. Flat Configuration: Erlang's approach, where only top-level keys are considered.

    Runtime Configuration with Runtime.exs

    Benefits and Challenges

    Łukasz discussed the introduction of runtime.exs in Elixir 1.10, designed to handle runtime configuration more effectively. While it offers several benefits, it also introduces challenges, particularly when dealing with OTP applications and dependencies.


    Unified Configuration: One file for both development and production. Flexibility: Easier to manage configurations that need to change at runtime.


    Dependency Management: Ensuring configurations are applied correctly in OTP applications. Complexity: Added layer of configuration that needs careful handling.

    Practical Demonstration

    Real-World Application

    Łukasz demonstrated the configuration process using a real-world example, showing how different configuration methods interact and the potential pitfalls developers might encounter.

    Demo Highlights:

    Setting Up Configurations: Step-by-step setup of config.exs and runtime.exs. Handling Conflicts: Techniques to manage and resolve configuration conflicts. Ensuring Consistency: Best practices for maintaining consistent configurations across environments.

    Best Practices

    Effective Configuration Management

    Łukasz shared best practices for managing configurations effectively, emphasizing the importance of understanding the lifecycle of configuration files and the impact of each method.

    Best Practices:

    Consistent Environments: Ensure configurations are consistent across development, staging, and production. Documentation: Clearly document configuration settings and their purposes. Testing: Regularly test configurations to catch issues early.


    Łukasz Niemier’s presentation at Elixir Meetup #2 shed light on the often-overlooked complexities of configuring Elixir applications. By understanding the different configuration methods and their implications, developers can manage their applications more effectively and avoid common pitfalls.

    Join the Community

    Ready to explore the reliability of Elixir and Erlang?

    Register for the next Elixir Meetup at Curiosum Meetups: Registration Join our community of Elixir enthusiasts at Elixir LinkedIn Group Prefer watching the presentation? Here’s the video

    Mikołaj Musioł Recruitment Specialist
    Mikołaj Musioł IT Recruitment & HR Specialist

    Read more
    on #curiosum blog