-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Does not respect defaults set in config.exs #6
Comments
This seems to be an issue with when the config is read inside a phoenix project. I did some digging and tried recompiling the project by deleting the I updated the config :nanoid,
size: 4,
alphabet: "0123456789abcdef" But it still uses the old config when I run IEx iex(1)> Nanoid.generate()
"efbf07642ca92851159ed" So again I deleted the compiled files, now only the Now when I run IEx it has picked up the new config. iex(1)> Nanoid.generate()
"ad88" This is a pretty acceptable workaround since this only seems to be an issue in Phoenix projects. I won't be changing the defaults for Nanoid any time soon in the project but still a little bit annoying having to figure this out. |
Many thanks for your testing and your workaround. I think the problem is the use of module attributes, which were assigned during compile time. It seems that the configuration in the To avoid this issue I'll introduce a |
@codehugger Many thanks so far. |
@railsmechanic I have tested this and I can confirm that a simple IEx restart is enough to pick up the new config :) |
Does this have any impact on the performance? I made the former config changes (for the test-env) working by calling
|
Not that I have noticed but I have not made any extensive testing.
On Tue, 16 Jun 2020 at 11:22, Florian Breisch ***@***.***> wrote:
Does this have any impact on the performance?
I made the former config changes (for the test-env) working by calling
MIX_ENV=test mix deps.compile nanoid --force
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#6 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAAEZZQTCSRNJFZZDWBPTTRW5IWBANCNFSM4NLNH7IQ>
.
--
./bjarki
|
Unfortunately yes. I've done a benchmark of using module attributes vs. reading the application environment: Using module attributes are always faster. It's questionable whether the effects are acceptable. But I think faster is always better. But using a If someone need runtime configuration it's possible to pass a custom alphabet and size to the |
Ah yeah - that sounds pretty reasonable! Thank you very much for your work! |
I released v2.0.3 which now uses the |
It seems that the Nanoid generate functions are not picking up the values set in config.exs.
I currently have this is my config/config.exs inside a phoenix project
When I open the shell
iex -S mix
I get the followingThis shows that the correct configuration is loaded into the iex but it is not being picked up correctly by the module.
The text was updated successfully, but these errors were encountered: