Giter Site home page Giter Site logo

Comments (8)

katanacrimson avatar katanacrimson commented on May 2, 2024

looking in app.js further, this would be far more ideal than interacting directly with process.std*, it'd be much more readable.

from nodebb.

julianlam avatar julianlam commented on May 2, 2024

Nice -- I was not aware of the commander module. Will integrate for the next release.

from nodebb.

katanacrimson avatar katanacrimson commented on May 2, 2024

Also worth considering is nconf - it's a bit heavier and lacks the prompting, but provides a mixture of configuration methods.

https://github.com/flatiron/nconf

That means you'd also have defaults, hierarchies, ENV variables, etc.

from nodebb.

julianlam avatar julianlam commented on May 2, 2024

Merged into master at 3c62b86 from branch nconf (since deleted)

from nodebb.

katanacrimson avatar katanacrimson commented on May 2, 2024

145898c#L0R41

Candidate for path.join imo.

145898c#L0R82

Better written as templates.ready(webserver.init); don't need to pass a function to call a function when all we need is a callable. Won't need to waste the memory.

145898c#L0R115

You might as well use both nconf and commander here - specifically here, commander would be the ideal.

Relevant:
https://github.com/visionmedia/commander.js/#promptmsg-fn
https://github.com/visionmedia/commander.js/#passwordmsg-mask-fn

Also look into async.series using an object for storing functions - each function would then be your ask() call, and you'd get away from indent hell that way. Would look far cleaner and easier to read.

145898c#L4R89

Look into node-validator / express-validator for a better method of email validation.

145898c#L0R159

Rather than defining default configs here, why not do so at the top of the file beside this?

Relevant, https://github.com/flatiron/nconf#hierarchical-configuration - look at nconf.defaults()


Other than that, looking like a decent improvement.

from nodebb.

julianlam avatar julianlam commented on May 2, 2024

Thanks,

Re: indent hell - I've actually taken out all of the nested asks and placed them inside an async.eachSeries in /src/install.js: https://github.com/designcreateplay/NodeBB/blob/3feb977cc44a695dc5d35305c60cbdb1f6b8d60d/src/install.js#L39

As for nconf.defaults(), I wasn't 100% sure whether I could use nconf.save(), since the way I understand, it saves the entire config contents into the file, including other values that are nconf.set-ed. It isn't a problem now, but if I were to update the current admin configs (themes, motd, etc) to use nconf-redis, then I'm not exactly sure what would be saved where. Let me know if I am wrong...

The latest commit has the defaults defined in install.js as well: 3c62b86#L6R17

from nodebb.

julianlam avatar julianlam commented on May 2, 2024

commander should be good, especially with the prompt method.

from nodebb.

katanacrimson avatar katanacrimson commented on May 2, 2024

@julianlam regarding nconf-redis, that is something of which I am not familiar with.

I would suggest asking the developer straight up about the behavior.

from nodebb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.