globe-config
v1.0.0
Published
A light-weight tool for global configuration.
Downloads
2
Readme
globe-config
A light-weight tool for global configuration.
Table of contents
Installation
$ npm install globe-config
Introduction
In Python(and other similar languages), relative path starts from the entry file.For instance,
db.py:
def getConnection():
#some code to get and to return a database connection
main.py:
import db
con = db.getConnection()
dir/test.py:
import db
con = db.getConnection()
As you can see, same code(import db) is used to including codes in file "db.py". But with "require" syntax in nodejs, relative path must reflect the relative location between the including and the included.
main.js
require('./db');
dir/test.py:
require('../db');
This modeul is created to solve this problem.
Usage
This module has only one api: define, whose prototype is defined as follow:
function function define(key, value, overwrite)
Params:
- 'key': key for the inserted value
- 'value': value to be inserted
- 'overwrite': OPTIONAL, whether to overwrite the current corresponding value of the given key.
var config = require('globe-config');
config.define('name', 'farseer810');
console.log(config.name);
config.define('funcToBeUsedInOtherFiles', function(){});