Comments (12)
@Licenser could you include the real-world example you ran in to?
from cuttlefish.
- The mDNS library I use auto detects the NIC to use unless a IP to use is specified in the app.config.
- The main app will use either a autodetected or a specified IP/Port combination.
In the schema I tried to assing the mdns ip based on weather the ip/port is set, this needed a translation, which should not set anything in the app.config when ip/port is not set.
from cuttlefish.
@Licenser Would having the translation return 'undefined' when the IP/Port combination solve the problem?
from cuttlefish.
Yap, it would turn into {ok, undefined}
with the get_env which is different form undefined
aside of adding a third fork in the code path it'd break the claim that we can use get_env the same way as before ;)
from cuttlefish.
@Licenser what if you used get_env/3 instead of get_env/2?
from cuttlefish.
Not available in erlang R15 :(, that said in R16 I could put in the code to default to {ok, undefined}
but that still would be kind of a horrible hackish solution.
from cuttlefish.
So it's no longer 'undefined' it's "defined as undefined
"
from cuttlefish.
yea but get_env treats those two situations differently:
- if it is undefined
get_env(something)
returnsundefined
- if it is defined as
undefined
thenget_env(something)
returns{ok, undefined}
from cuttlefish.
I'll take this scenario under advisement, but for now, your best bet is to add the third clause for reading this value:
{ok, undefined} -> blah;
undefined -> blah;
{ok, Value} -> blah
from cuttlefish.
To add to this I just thought of another issue, if someone were to use get_env/3
the default would not be picked when the value is set to undefined
instead of not being defined at all breaking that behavior and being quite counter intuitive.
from cuttlefish.
get_env/3
has it's own issues, use at your own risk ;)
from cuttlefish.
@Licenser We now have an API function cuttlefish:unset()
which can be used to skip emitting a value to the generated configuration. Closing this issue.
from cuttlefish.
Related Issues (20)
- [docs] db_path variable in Cuttlefish-for-non-node_package-users [JIRA: RIAK-2037]
- Cannot compile with Erlang version 18 [JIRA: RIAK-2055] HOT 8
- crash on riak cs advanced.conf [JIRA: RIAK-2216] HOT 3
- Documentation [JIRA: RIAK-2250] HOT 1
- Relx support [JIRA: RIAK-2251] HOT 4
- Lager 3? [JIRA: RIAK-2309] HOT 2
- Quoted IPv6 address support in address:port pairs [JIRA: RIAK-2462]
- "merge" setting for mappings is broken [JIRA: RIAK-2549]
- Make erlang_vm.schema optional [JIRA: RIAK-2630]
- exception error: no function clause matching lists:unzip/3 [JIRA: RIAK-2783] HOT 1
- Support for sections in .conf [JIRA: RIAK-3054] HOT 3
- Nested config hard to get [JIRA: RIAK-3125]
- Compiling with Elixir fails [JIRA: RIAK-3371] HOT 8
- compile error [JIRA: RIAK-3413]
- Compiling on Erlang 20 HOT 3
- Old values that no longer make sense HOT 3
- No source code for latest cuttlefish version on hex.pm HOT 1
- Show an error message
- Is this repository deprecated? HOT 2
- Can't escape "#" in config file HOT 1
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 cuttlefish.