electrode-io / electrode-confippet Goto Github PK
View Code? Open in Web Editor NEWnode.js environment aware application configuration
License: Other
node.js environment aware application configuration
License: Other
I tried using union merge on an array by prepending +
to the key, but it turns out that both the source and the target array need to have the +
in the key name. That is surprising. Should it not be possible to append to arrays without requiring the original array key to start with a +
?
I also noticed that there are still several calls to util.merge
instead of util.uMerge
in the code, and I wonder if that is correct?
Sorry, not a windows user myself, but I know that you're supposed to use path.join
or path.resolve
to get valid paths on both Unix and Windows.
I'm thinking that maybe confippet could have a default function root
which takes the remaining refs, resolves them, splits them on /
, and then uses path.resolve(config.root || process.cwd, ...refs)
to generate a valid path on all platforms? So you could e.g. specify paths as icons: '{{root:config.assets:-icons}}'
?
I suppose some way to escape :
and /
in refs would also be necessary.
I have tried adding a default.json, default.yaml under the config directory but keep getting this error:
Error: Config provider deployment: no file development of extensions json,yaml,js found in /myapp/config
at load (/myapp/node_modules/electrode-confippet/lib/compose-config.js:36:17)
at list.sort.forEach (/myapp/node_modules/electrode-confippet/lib/compose-config.js:87:9)
at Array.forEach ()
at composeConfigDir (/myapp/node_modules/electrode-confippet/lib/compose-config.js:76:6)
at dirs.forEach (/myapp/node_modules/electrode-confippet/lib/compose-config.js:107:5)
at Array.forEach ()
at composeConfig (/myapp/node_modules/electrode-confippet/lib/compose-config.js:106:8)
at Config.compose (/myapp/node_modules/electrode-confippet/lib/store.js:31:28)
at load (/myapp/node_modules/electrode-confippet/lib/preset-config.js:31:13)
at Object.autoLoad (/myapp/node_modules/electrode-confippet/lib/preset-config.js:40:5)
I am using "electrode-confippet": "^1.5.0" and i am seeing that
I think this is a bug on documentation , that needs to be fixed
Probably a stupid question but are you able to reference confippet config values in React code?
hoping to keep all my dev url's defined in one place.
Maybe I'm overstepping some bounds here, and I really appreciate Walmart open-sourcing Electrode, but shouldn't this project mention https://github.com/lorenwest/node-config in thanks for the obvious inspiration?
I have no stakes here, in fact I'm very deeply looking into replacing my home grown solution with Electrode because I was doing the same thing (configuration over code, remove all possible boilerplate).
I'd like to pass in some config variables to the react components as well - is there any way to use or pass it in to the client components as well? I suppose I can pass it in as initial state into a redux store, but is there a better way?
As I can see heavy inspiration of node-config
:
https://github.com/lorenwest/node-config
Is is possible to provide defered
value like in example below?
https://github.com/lorenwest/node-config/wiki/Configuration-Files#user-content-javascript-module---js
package.json
, so you don't know why a certain dep was addedIt seems to me that these issues can be fixed by generating the package.json from config. Confippet is well-placed for this IMHO; packages could be put into the configuration, maybe with some logic injection.
When combining the configuration, the final set of required packages and settings is known and automatically compared to package.json. If the package.json differs, a warning is printed asking to regenerate it, or to incorporate the new versions into the app config (it could list where what version should go, like app config says [email protected] but package.json has @15.3
).
TL;DR: This would allow e.g. configuring webpack SASS support and automatically installing sass-loader
.
(At the beginning of the package.json there could be an attribute "__autogenerated": "This file was autogenerated by confippet. Do not edit."
)
Hello,
When i use electrode-confippet in my code (anywhere in ./electrode/client):
../services/api.js
import axios from 'axios';
const config = require("electrode-confippet").config;
const BASE_URL = config.$("api.url");
const instance = axios.create({
baseURL: BASE_URL
});
export const API = instance;
(even if i just have require("electrode-confippet"))
I have errors:
WARNING in ./~/electrode-confippet/lib/ext-handlers.js
Critical dependencies:
7:8-15 require function is used in a way in which dependencies cannot be statically extracted
8:6-13 require function is used in a way in which dependencies cannot be statically extracted
@ ./~/electrode-confippet/lib/ext-handlers.js 7:8-15 8:6-13
ERROR in ./~/electrode-confippet/lib/process-config.js
Module not found: Error: Cannot resolve module 'fs' in /Users/ericsanchez/Projects/projects-node/tproject/node_modules/electrode-confippet/lib
@ ./~/electrode-confippet/lib/process-config.js 4:11-24
ERROR in ./~/electrode-confippet/lib/compose-config.js
Module not found: Error: Cannot resolve module 'fs' in /Users/ericsanchez/Projects/projects-node/tproject/node_modules/electrode-confippet/lib
@ ./~/electrode-confippet/lib/compose-config.js 4:11-24
ERROR in ./~/electrode-confippet/lib/ext-handlers.js
Module not found: Error: Cannot resolve module 'fs' in /Users/ericsanchez/Projects/projects-node/tproject/node_modules/electrode-confippet/lib
@ ./~/electrode-confippet/lib/ext-handlers.js 4:11-24
Whereas i use require("electrode-confippet").config in electrode/server/ it's ok...
An idea ?
Thanks.
Currently, you can only throw on failure, but you can't get a warning instead. failMissing
and warnMissing
work on different provider types.
Is this intentional? I would like to remind my users to create a config file for the current environment, not crash the app…
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.