From 65f886eafae32a81c4b2162a247910b7089e1577 Mon Sep 17 00:00:00 2001 From: Jayson Vantuyl Date: Wed, 3 Apr 2024 06:06:01 -0700 Subject: [PATCH] use modern config handling (#44) * use modern config handling Breaks compatibility with Elixir versions prior to 1.11. * Bump version to 0.4.0 --------- Co-authored-by: Jayson Vantuyl Co-authored-by: Yuri Lukyanov Co-authored-by: Yuri Lukyanov --- config/config.exs | 6 +++--- config/dev.exs | 2 +- config/prod.exs | 2 +- config/test.exs | 2 +- lib/holidefs.ex | 2 +- mix.exs | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/config/config.exs b/config/config.exs index 78a3759..3d474da 100644 --- a/config/config.exs +++ b/config/config.exs @@ -1,6 +1,6 @@ # This file is responsible for configuring your application -# and its dependencies with the aid of the Mix.Config module. -use Mix.Config +# and its dependencies with the aid of the Config module. +import Config # This configuration is loaded before any dependency and is restricted # to this project. If another project depends on this project, this @@ -21,4 +21,4 @@ use Mix.Config # config :logger, level: :info # -import_config "#{Mix.env()}.exs" +import_config "#{config_env()}.exs" \ No newline at end of file diff --git a/config/dev.exs b/config/dev.exs index d2d855e..becde76 100644 --- a/config/dev.exs +++ b/config/dev.exs @@ -1 +1 @@ -use Mix.Config +import Config diff --git a/config/prod.exs b/config/prod.exs index d2d855e..becde76 100644 --- a/config/prod.exs +++ b/config/prod.exs @@ -1 +1 @@ -use Mix.Config +import Config diff --git a/config/test.exs b/config/test.exs index b386632..1509595 100644 --- a/config/test.exs +++ b/config/test.exs @@ -1,4 +1,4 @@ -use Mix.Config +import Config config :holidefs, locales: [ diff --git a/lib/holidefs.ex b/lib/holidefs.ex index f2a242c..0f5b35d 100644 --- a/lib/holidefs.ex +++ b/lib/holidefs.ex @@ -56,7 +56,7 @@ defmodule Holidefs do fed: "Federal Reserve" } - @locale_keys Application.get_env(:holidefs, :locales, Map.keys(@all_locales)) + @locale_keys Application.compile_env(:holidefs, :locales, Map.keys(@all_locales)) @locales Map.take(@all_locales, @locale_keys) @doc """ diff --git a/mix.exs b/mix.exs index 71dcca4..875a86c 100644 --- a/mix.exs +++ b/mix.exs @@ -2,13 +2,13 @@ defmodule Holidefs.Mixfile do use Mix.Project @github_url "https://github.com/toggl/holidefs" - @version "0.3.8" + @version "0.4.0" def project do [ app: :holidefs, version: @version, - elixir: "~> 1.5", + elixir: "~> 1.11", elixirc_paths: elixirc_paths(Mix.env()), package: package(), start_permanent: Mix.env() == :prod,