Skip to content

New store type - js, or support formatter for js  #96

@osher

Description

@osher

configuration files that are written in JSON have the following limitations:
1 - they do not support comments
2 - keys require quotes
3 - they do not support expressions
4 - they do not allow dynamic generation of keys (for whatever reason)

As a result, in systems I was involved with there is a config folder in deed, but the files there are simple JS files that are loaded using the simple good old require mechanism.

So, for an over simplified example, instead of

{ "env" : "BR1"
, "domain" : "br1.mysite.com"
, "session": 
   { "cookie" : "br1sessid"
   , "expire" : 3000
   }
}

we write:

var ENV = process.args.NODE_MY_ENV || "dev"
module.exports = 
{ "env" : ENV.toUpperCase()
, "domain" : ENV + ".mysite.com" //on production ENV will be www
, "session": 
   { "cookie" : ENV + "sessid"  //TODO - yada yada bla bla
   , "expire" : 3000
   }
}

would such a store engine be welcomed here?
I mean, should I even start?
In any case, this store is different then file. it loads from file, but won't save, so fooling around with eval and a sandbox as implementation of parse for file formatter does not seem right to me...

Alternatively, is there a way you wish to feature to add custom stores?

If you're interested - I'd be happy to talk to somebody

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions