Comments (3)
I ran into this as well and I believe it's actually a limitation with Mix.Config.read!/1
.
In distillery, that function is used to read the base configuration:
https://github.com/bitwalker/distillery/blob/master/lib/mix/lib/releases/assembler.ex#L558
Then it's merged with the release configuration and written:
https://github.com/bitwalker/distillery/blob/master/lib/mix/lib/releases/assembler.ex#L537
Observations
Create a new project and add a key to the config whose value is an anonymous function:
mix new potato && cd potato
echo "config :potato, my_var: fn -> :ok end" >> config/config.exs
Start an iex session, read the config, and notice the output:
iex> config = Mix.Config.read!("config/config.exs")
[potato: [my_var: #Function<12.3456789/0 in :erl_eval.expr/5>]]
Correct me if I'm wrong, but that function will only exist in the current BEAM instance. We can't serialize/write it and expect it to be valid during a subsequent execution of the program when we read it; it will be redefined at run time in the new BEAM instance.
Edit: Removing the last observation as I misunderstood the purpose of Mix.Config.persist/1
.
from exrm.
@pcewing It's not actually a problem with Mix.Config.read!/1
, as it is supposed to return the captured function. The issue is that we need to write a function in capture syntax to the sys.config
file, so that when it is evaluated by the VM, we get a valid capture back. What happens now is we serialize the capture, which of course is invalid. It's something I have some ideas on how to tackle, but I'll be doing so in distillery rather than exrm
.
from exrm.
Thank you @bitwalker! I'll close this since directions are clear --> Switch to distillery
from exrm.
Related Issues (20)
- Mix.env/1 being used with string instead of atom when `--env="prod"` passed from script HOT 1
- Generating upgrade fails when attaching git revision to version HOT 1
- "/rel/<projectname>/bin/<projectname> stop" does not work HOT 3
- `mix release` fails with `{unreachable_package, cowlib}` HOT 4
- Error when following Phoenix Walkthrough Documentation
- [Bug?] Not responding to pings HOT 1
- RELX_REPLACE_OS_VARS boot script fails on awk with env vars containing certain characters HOT 3
- Color codes always output
- Release on ubuntu but cannot use in macOS HOT 2
- Remote console doesn't seem to have access to all applications in an umbrella app HOT 1
- Running mix release in docker cause MatchError. HOT 1
- Upgrade releases and storage... HOT 1
- deploy: module Experimental.Flow is not available
- mix release fails with 'no case clause matching: :eacces' HOT 8
- Raspbian Jessie with erlang 19 failed to start release HOT 1
- using a different erts version when deploying a release
- Default protocols are not replaced by consolidated in release. HOT 3
- Error while trying to rewrite app file HOT 2
- Mix.Shell.cmd/2 no longer exists, could we get an update to use the new Mix.Shell.cmd/3?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from exrm.