From 39124710138d1e38da3f10de9a4edcd137f54188 Mon Sep 17 00:00:00 2001 From: Fernando Mendes Date: Tue, 7 Jul 2020 17:48:15 +0100 Subject: [PATCH] Use Application.get_env/3 calls instead of module attributes --- lib/nanoid/configuration.ex | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/nanoid/configuration.ex b/lib/nanoid/configuration.ex index 012bec9..22a5ad2 100644 --- a/lib/nanoid/configuration.ex +++ b/lib/nanoid/configuration.ex @@ -5,8 +5,8 @@ defmodule Nanoid.Configuration do ## -- DEFAULT ATTRIBUTES @default_mask 63 - @default_size Application.get_env(:nanoid, :size, 21) - @default_alphabet Application.get_env(:nanoid, :alphabet, "_-0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ") + @default_size 21 + @default_alphabet "_-0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" @default_alphabet_length String.length(@default_alphabet) @doc """ @@ -25,7 +25,7 @@ defmodule Nanoid.Configuration do 21 """ @spec default_size :: Integer.t() - def default_size, do: @default_size + def default_size, do: Application.get_env(:nanoid, :size, @default_size) @doc """ Returns the default alphabet of a nanoid used by the generators. @@ -34,7 +34,7 @@ defmodule Nanoid.Configuration do "_-0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" """ @spec default_alphabet :: String.t() - def default_alphabet, do: @default_alphabet + def default_alphabet, do: Application.get_env(:nanoid, :alphabet, @default_alphabet) @doc """ Returns the length of the default alphabet.