From e2bec9f5ae946478545adbf229cae982cdc64f8f Mon Sep 17 00:00:00 2001 From: Loren West Date: Tue, 6 Nov 2012 17:08:26 -0800 Subject: [PATCH] Updated history and docs --- History.md | 1 + doc/1-protected-test.js.html | 10 +++++----- doc/2-config-test.js.html | 10 +++++----- doc/Config.html | 10 +++++----- doc/ConfigTest.html | 10 +++++----- doc/ProtectedTest.html | 10 +++++----- doc/config.js.html | 20 ++++++++++++-------- doc/default.js.html | 10 +++++----- doc/index.html | 10 +++++----- doc/module_config.html | 10 +++++----- doc/module_test.html | 10 +++++----- doc/raw.json | 2 +- 12 files changed, 59 insertions(+), 54 deletions(-) diff --git a/History.md b/History.md index 1d6b2d3f..170afd95 100644 --- a/History.md +++ b/History.md @@ -4,6 +4,7 @@ * Moved coffee-script and js-yaml from optionalDependencies back to devDependencies to trim the install size for those not needing these packages. + * Promoted $HOSTNAME and $HOST above OS.hostname() 0.4.17 / 2012-09-26 =================== diff --git a/doc/1-protected-test.js.html b/doc/1-protected-test.js.html index f5499827..ea9acaa1 100644 --- a/doc/1-protected-test.js.html +++ b/doc/1-protected-test.js.html @@ -4,11 +4,11 @@ test 1-protected-test.js - - + + - - + + @@ -418,7 +418,7 @@

Files


Released on github under the Apache License 2.0 -version 0.4.17 +version 0.4.18
- + + @@ -314,7 +314,7 @@

Files


Released on github under the Apache License 2.0 -version 0.4.17 +version 0.4.18
- + + @@ -1358,7 +1358,7 @@

Methods


Released on github under the Apache License 2.0 -version 0.4.17 +version 0.4.18
- + + @@ -120,7 +120,7 @@

Files


Released on github under the Apache License 2.0 -version 0.4.17 +version 0.4.18
- + + @@ -120,7 +120,7 @@

Files


Released on github under the Apache License 2.0 -version 0.4.17 +version 0.4.18
- + + @@ -626,10 +626,14 @@

// Determine the host name from the OS module, $HOST, or $HOSTNAME // Remove any . appendages, and default to null if not set try { - var OS = require('os'); - var hostName = OS.hostname(); + var hostName = process.env.HOST || process.env.HOSTNAME; + + if (!hostName) { + var OS = require('os'); + hostName = OS.hostname(); + } } catch (e) { - hostName = process.env.HOST || process.env.HOSTNAME; + hostName = ''; } hostName = hostName ? hostName.split('.')[0] : null; @@ -1175,7 +1179,7 @@

Files


Released on
github under the Apache License 2.0 -version 0.4.17 +version 0.4.18
- + + @@ -98,7 +98,7 @@

Files


Released on github under the Apache License 2.0 -version 0.4.17 +version 0.4.18
- + + @@ -290,7 +290,7 @@

Files


Released on github under the Apache License 2.0 -version 0.4.17 +version 0.4.18
- + + @@ -141,7 +141,7 @@

Files


Released on github under the Apache License 2.0 -version 0.4.17 +version 0.4.18
- + + @@ -113,7 +113,7 @@

Files


Released on github under the Apache License 2.0 -version 0.4.17 +version 0.4.18
", "guessedname": "Config", "guessedtype": "function"}, "_diffDeep": {"return": {"type": "object", "description": "A differential object, which if extended onto object1 would\nresult in object2."}, "description": "Returns an object containing all elements that differ between two objects.\n

\nThis method was designed to be used to create the runtime.json file\ncontents, but can be used to get the diffs between any two Javascript objects.\n

\n

\nIt works best when object2 originated by deep copying object1, then\nchanges were made to object2, and you want an object that would give you\nthe changes made to object1 which resulted in object2.\n

", "protected": "", "params": [{"type": "object", "name": "object1", "description": " The base object to compare to"}, {"type": "object", "name": "object2", "description": " The object to compare with"}, {"type": "integer", "name": "depth", "description": " An optional depth to prevent recursion. Default: 20."}], "guessedname": "_diffDeep", "guessedtype": "function"}, "_isObject": {"return": {"type": "boolean", "description": "TRUE if the arg is an object, FALSE if not"}, "description": "Is the specified argument a regular javascript object?\nThe argument is an object if it's a JS object, but not an array.", "protected": "", "params": [{"type": "MIXED", "name": "arg", "description": " An argument of any type."}], "guessedname": "_isObject", "guessedtype": "function"}, "_parseFile": {"return": {"type": "configObject", "description": "The configuration object parsed from the file"}, "description": "Parse and return the specified configuration file.\nIf the file exists in the application config directory, it will\nparse and return it as a JavaScript object.\nThe file extension determines the parser to use.\n.js = File to run that has a module.exports containing the config object\n.json = File is parsed using JSON.parse()\n.coffee = File to run that has a module.exports with coffee-script containing the config object\n.yaml = Parsed with a YAML parser\nIf the file doesn't exist, a null will be returned. If the file can't be\nparsed, an exception will be thrown.\nThis method performs synchronous file operations, and should not be called\nafter synchronous module loading.", "protected": "", "params": [{"type": "string", "name": "fullFilename", "description": " The full file path and name"}], "guessedname": "_parseFile", "guessedtype": "function"}, "_extendDeep": {"return": {"type": "object", "description": "The altered mergeInto object is returned"}, "description": "Extend an object, and any object it contains.\nThis does not replace deep objects, but dives into them\nreplacing individual elements instead.", "protected": "", "params": [{"type": "object", "name": "mergeInto", "description": " The object to merge into"}, {"type": "object...", "name": "mergeFrom...", "description": " - Any number of objects to merge from"}, {"type": "integer", "name": "depth", "description": " An optional depth to prevent recursion. Default: 20."}], "guessedname": "_extendDeep", "guessedtype": "function"}}, "file": "config.js", "shortname": "Config", "description": "

Runtime Application Configurations

\n

\nThe config module exports a singleton object representing all runtime\nconfigurations for this application deployment.\n

\n

\nApplication configurations are stored in files within the config directory\nof your application. The default configuration file is loaded, followed\nby files specific to the deployment type (development, testing, staging,\nproduction, etc.).\n

\n

\nFor example, with the following config/default.yaml file:\n

\n
\n...\ncustomer:\n  initialCredit: 500\n  db:\n    name: customer\n    port: 5984\n...\n
\n

\nThe following code loads the customer section into the CONFIG variable:\n

\n

\nvar CONFIG = require('config').customer;\n...\nnewCustomer.creditLimit = CONFIG.initialCredit;\ndatabase.open(CONFIG.db.name, CONFIG.db.port);\n...\n
"}, "ProtectedTest": {"name": "ProtectedTest", "namespace": "", "module": "test", "guessedname": "PrivateTest", "file": "1-protected-test.js", "guessedtype": "property", "shortname": "ProtectedTest", "description": "

Tests for underlying node-config utilities. To run type:

\n
npm test config
"}}, "version": "0.4.17", "modules": {"test": {"description": "

Unit tests

", "submodules": [], "classlist": ["ProtectedTest", "ConfigTest"], "filelist": ["1-protected-test.js", "2-config-test.js", "default.js"], "subdata": {}, "name": "test"}, "config": {"description": "

Runtime Application Configurations

\n

\nThe config module exports a singleton object representing all runtime\nconfigurations for this application deployment.\n

\n

\nApplication configurations are stored in files within the config directory\nof your application. The default configuration file is loaded, followed\nby files specific to the deployment type (development, testing, staging,\nproduction, etc.).\n

\n

\nFor example, with the following config/default.yaml file:\n

\n
\n...\ncustomer:\n  initialCredit: 500\n  db:\n    name: customer\n    port: 5984\n...\n
\n

\nThe following code loads the customer section into the CONFIG variable:\n

\n

\nvar CONFIG = require('config').customer;\n...\nnewCustomer.creditLimit = CONFIG.initialCredit;\ndatabase.open(CONFIG.db.name, CONFIG.db.port);\n...\n
", "submodules": [], "classlist": ["Config"], "filelist": ["config.js"], "subdata": {}, "name": "config"}}, "filemap": {"default.js": {"classlist": [], "name": "default.js", "module": "test"}, "2-config-test.js": {"classlist": ["ConfigTest"], "name": "2-config-test.js", "module": "test"}, "config.js": {"classlist": ["Config"], "name": "config.js", "module": "config"}, "1-protected-test.js": {"classlist": ["ProtectedTest"], "name": "1-protected-test.js", "module": "test"}}} \ No newline at end of file +{"majorversion": 3, "classmap": {"ConfigTest": {"name": "ConfigTest", "namespace": "", "module": "test", "guessedname": "ConfigTest", "file": "2-config-test.js", "guessedtype": "property", "shortname": "ConfigTest", "description": "

Unit tests for the node-config library. To run type:

\n
npm test config
"}, "Config": {"name": "Config", "namespace": "", "module": "config", "methods": {"watchForConfigFileChanges": {"params": [{"type": "Integer", "name": "interval", "description": " - Polling interval in milliseconds. Defaults to 2500."}], "description": "Change the runtime.json file watching polling interval.\n

\nNode-config automatically monitors and apply changes made to the\nconfig/runtime.json file. This paradigm allows for manual changes to running\napplication servers, and for multi-node application servers to keep in sync.\n

\n

\nThis method allows you to change the polling interval from the default\ninterval (2.5 seconds), or to turn file watching off. On Linux systems with\ninotify, and in node.js versions 0.6 and above, this interval is ignored.\n

", "guessedname": "watchForConfigFileChanges", "guessedtype": "function"}, "_attachProtoDeep": {"return": {"type": "", "description": "toObject"}, "description": "Attach the Config class prototype to all config objects recursively.\n

\nThis allows you to do anything with CONFIG sub-objects as you can do with\nthe top-level CONFIG object. It's so you can do this:\n

\n
\nvar CUST_CONFIG = require('config').Customer;\nCUST_CONFIG.watch(...)\n
", "protected": "", "params": [{"type": "", "name": "toObject", "description": ""}, {"type": "", "name": "depth", "description": ""}], "guessedname": "_attachProtoDeep", "guessedtype": "function"}, "_persistConfigsOnChange": {"protected": "", "params": [{"type": "object", "name": "object", "description": " - The config object to watch"}], "description": "

\nWatch the specified object for a change in properties, and persist changes\nto runtime.json when a change is detected.\n

", "guessedname": "_persistConfigsOnChange", "guessedtype": "function"}, "setModuleDefaults": {"return": {"type": "object", "description": "moduleConfig - The module level configuration object."}, "params": [{"type": "string", "name": "moduleName", "description": " - Name of your module."}, {"type": "object", "name": "defaultProperties", "description": " - The default module configuration."}], "description": "

\nSet default configurations for a node.js module.\n

\n

\nThis allows module developers to attach their configurations onto the\ndefault configuration object so they can be configured by the consumers\nof the module.\n

\n

Using the function within your module:

\n
\nvar CONFIG = require(\"config\");\nCONFIG.setModuleDefaults(\"MyModule\", {\n  templateName: \"t-50\",\n  colorScheme: \"green\"\n});\n
\n// Template name may be overridden by application config files\nconsole.log(\"Template: \" + CONFIG.MyModule.templateName);\n
\n

\nThe above example results in a \"MyModule\" element of the configuration\nobject, containing an object with the specified default values.\n

", "guessedname": "setModuleDefaults", "guessedtype": "function"}, "watch": {"return": {"type": "object", "description": "object - The original object is returned - for chaining."}, "params": [{"type": "object", "name": "object", "description": " - The object to watch."}, {"type": "string", "name": "property", "description": " - The property name to watch. Watch all object properties if null."}, {"type": "function(object, propertyName, priorValue, newValue)", "name": "handler", "description": " - Handler called when a property change is detected.\nThe handler is run along with other handlers registered for notification.\nIf your handler changes the value of the property, that change is applied after all handlers have finished processing the current change.\nThen all handlers (including this one) will be called again with the newly changed value."}, {"type": "integer", "name": "depth", "description": " (optional) - If watching all object properties or if the specified property is an object, this specifies the depth of the object graph to watch for changes. Default 6."}], "description": "

Monitor a configuration value for runtime changes.

\n

\nConfiguration values can be changed at runtime by the application or by a\nmanual change to the config/runtime.json file.\nThis method lets you specify a function to run when a configuration\nvalue changes.\n

\n

\nThis was built for monitoring changes to configuration values,\nbut it can be used for watching changes to any javascript object.\n

\n

Example:

\n
\nvar CONFIG = require('config').customer;\n...\n// Watch for any changes to the customer configuration\nCONFIG.watch(CONFIG, null, function(object, propertyName, priorValue, newValue) {\n console.log(\"Customer configuration \" + propertyName + \" changed from \" + priorValue + \" to \" + newValue);\n});\n
", "guessedname": "watch", "guessedtype": "function"}, "_stripComments": {"return": {"type": "string", "description": "The string with comments stripped."}, "description": "Strip all Javascript type comments from the string.\nThe string is usually a file loaded from the O/S, containing\nnewlines and javascript type comments.\nThanks to James Padolsey, and all who conributed to this implementation.\nhttp://james.padolsey.com/javascript/javascript-comment-removal-revisted/", "protected": "", "params": [{"type": "string", "name": "fileString", "description": " The string to strip comments from"}], "guessedname": "_stripComments", "guessedtype": "function"}, "makeHidden": {"return": {"type": "object", "description": "object - The original object is returned - for chaining."}, "params": [{"type": "object", "name": "object", "description": " - The object to make a hidden property into."}, {"type": "string", "name": "property", "description": " - The name of the property to make hidden."}, {"type": "mixed", "name": "value", "description": " - (optional) Set the property value to this (otherwise leave alone)"}], "description": "

Make a configuration property hidden so it doesn't appear when enumerating\nelements of the object.

\n

\nThe property still exists and can be read from and written to, but it won't\nshow up in for ... in loops, Object.keys(), or JSON.stringify() type methods.\n

\n

\nIf the property already exists, it will be made hidden. Otherwise it will\nbe created as a hidden property with the specified value.\n

\n

\nThis method was built for hiding configuration values, but it can be applied\nto any javascript object.\n

\n

Example:

\n
\nvar CONFIG = require('config');\n...\n// Hide the Amazon S3 credentials\nCONFIG.makeHidden(CONFIG.amazonS3, 'access_id');\nCONFIG.makeHidden(CONFIG.amazonS3, 'secret_key');\n
", "guessedname": "makeHidden", "guessedtype": "function"}, "_equalsDeep": {"return": {"type": "boolean", "description": "True if both objects have equivalent contents"}, "description": "Return true if two objects have equal contents.", "protected": "", "params": [{"type": "object", "name": "object1", "description": " The object to compare from"}, {"type": "object", "name": "object2", "description": " The object to compare with"}, {"type": "integer", "name": "depth", "description": " An optional depth to prevent recursion. Default: 20."}], "guessedname": "_equalsDeep", "guessedtype": "function"}, "_stripYamlComments": {"return": {"type": "string", "description": "The string with comments stripped."}, "description": "Strip YAML comments from the string\nThe 2.0 yaml parser doesn't allow comment-only or blank lines. Strip them.", "protected": "", "params": [{"type": "string", "name": "fileString", "description": " The string to strip comments from"}], "guessedname": "_stripYamlComments", "guessedtype": "function"}, "makeImmutable": {"return": {"type": "object", "description": "object - The original object is returned - for chaining."}, "params": [{"type": "object", "name": "object", "description": " - The object to attach an immutable property into."}, {"type": "string", "name": "property", "description": " - The name of the property to make immutable."}, {"type": "mixed", "name": "value", "description": " - (optional) Set the property value to this (otherwise leave alone)"}], "description": "

Make a configuration property immutable (assuring it cannot be changed\nfrom the current value).

\n

\nThis operation cannot be un-done.\n

\n

\nThis method was built for disabling runtime changes to configuration values,\nbut it can be applied to any javascript object.\n

\n

Example:

\n
\nvar CONFIG = require('config').customer;\n...\n// Obtain a DB connection using CONFIG parameters\ndatabase.open(CONFIG.db.name, CONFIG.db.port);\n...\n// Don't allow database changes after connect\nCONFIG.makeImmutable(CONFIG.db, 'name');\nCONFIG.makeImmutable(CONFIG.db, 'port');\n
", "guessedname": "makeImmutable", "guessedtype": "function"}, "_cloneDeep": {"return": {"type": "object", "description": "A new object with the elements copied from the copyFrom object"}, "description": "Return a deep copy of the specified object.\nThis returns a new object with all elements copied from the specified\nobject. Deep copies are made of objects and arrays so you can do anything\nwith the returned object without affecting the input object.", "protected": "", "params": [{"type": "object", "name": "copyFrom", "description": " The original object to copy from"}, {"type": "integer", "name": "depth", "description": " An optional depth to prevent recursion. Default: 20."}], "guessedname": "_cloneDeep", "guessedtype": "function"}, "_loadFileConfigs": {"protected": "", "return": {"type": "this", "description": "The configuration object"}, "description": "Load the individual file configurations.\n

\nThis method builds a map of filename to the configuration object defined\nby the file. The search order is:\n

\n
\ndefault.EXT\n(hostname).EXT\n(deployment).EXT\n(hostname)-(deployment).EXT\nlocal.EXT\nlocal-(deployment).EXT\nruntime.json\n
\n

\nEXT can be yaml, coffee, json, or js signifying the file type.\nyaml is in YAML format, coffee is a coffee-script,\njson is in strict JSON format, and js is a javascript executable file that is\nrequire()'d with module.exports being the config object.\n

\n

\n(hostname) is the $HOST environment variable if set, otherwise the\nhostname found from require('os').hostname()\n

\n

\n(deployment) is the deployment type, found in the $NODE_ENV environment\nvariable. Defaults to 'development'.\n

\n

\nThe runtime.json file contains configuration changes made at runtime either\nmanually, or by the application setting a configuration value.\n

", "guessedname": "_loadFileConfigs", "guessedtype": "function"}, "constructor": {"return": {"type": "object", "description": "CONFIG - The top level configuration object"}, "description": "

Get the configuration object.

\n

\nThe configuration object is a shared singleton object within the applicaiton,\nattained by calling require('config').\n

\n

\nUsually you'll specify a CONFIG variable at the top of your .js file\nfor file/module scope. If you want the root of the object, you can do this:\n

\n
\nvar CONFIG = require('config');\n
\n

\nSometimes you only care about a specific sub-object within the CONFIG\nobject. In that case you could do this at the top of your file:\n

\n
\nvar CONFIG = require('config').customer;\nor\nvar CUSTOMER_CONFIG = require('config').customer;\n
\n", "guessedname": "Config", "guessedtype": "function"}, "_diffDeep": {"return": {"type": "object", "description": "A differential object, which if extended onto object1 would\nresult in object2."}, "description": "Returns an object containing all elements that differ between two objects.\n

\nThis method was designed to be used to create the runtime.json file\ncontents, but can be used to get the diffs between any two Javascript objects.\n

\n

\nIt works best when object2 originated by deep copying object1, then\nchanges were made to object2, and you want an object that would give you\nthe changes made to object1 which resulted in object2.\n

", "protected": "", "params": [{"type": "object", "name": "object1", "description": " The base object to compare to"}, {"type": "object", "name": "object2", "description": " The object to compare with"}, {"type": "integer", "name": "depth", "description": " An optional depth to prevent recursion. Default: 20."}], "guessedname": "_diffDeep", "guessedtype": "function"}, "_isObject": {"return": {"type": "boolean", "description": "TRUE if the arg is an object, FALSE if not"}, "description": "Is the specified argument a regular javascript object?\nThe argument is an object if it's a JS object, but not an array.", "protected": "", "params": [{"type": "MIXED", "name": "arg", "description": " An argument of any type."}], "guessedname": "_isObject", "guessedtype": "function"}, "_parseFile": {"return": {"type": "configObject", "description": "The configuration object parsed from the file"}, "description": "Parse and return the specified configuration file.\nIf the file exists in the application config directory, it will\nparse and return it as a JavaScript object.\nThe file extension determines the parser to use.\n.js = File to run that has a module.exports containing the config object\n.json = File is parsed using JSON.parse()\n.coffee = File to run that has a module.exports with coffee-script containing the config object\n.yaml = Parsed with a YAML parser\nIf the file doesn't exist, a null will be returned. If the file can't be\nparsed, an exception will be thrown.\nThis method performs synchronous file operations, and should not be called\nafter synchronous module loading.", "protected": "", "params": [{"type": "string", "name": "fullFilename", "description": " The full file path and name"}], "guessedname": "_parseFile", "guessedtype": "function"}, "_extendDeep": {"return": {"type": "object", "description": "The altered mergeInto object is returned"}, "description": "Extend an object, and any object it contains.\nThis does not replace deep objects, but dives into them\nreplacing individual elements instead.", "protected": "", "params": [{"type": "object", "name": "mergeInto", "description": " The object to merge into"}, {"type": "object...", "name": "mergeFrom...", "description": " - Any number of objects to merge from"}, {"type": "integer", "name": "depth", "description": " An optional depth to prevent recursion. Default: 20."}], "guessedname": "_extendDeep", "guessedtype": "function"}}, "file": "config.js", "shortname": "Config", "description": "

Runtime Application Configurations

\n

\nThe config module exports a singleton object representing all runtime\nconfigurations for this application deployment.\n

\n

\nApplication configurations are stored in files within the config directory\nof your application. The default configuration file is loaded, followed\nby files specific to the deployment type (development, testing, staging,\nproduction, etc.).\n

\n

\nFor example, with the following config/default.yaml file:\n

\n
\n...\ncustomer:\n  initialCredit: 500\n  db:\n    name: customer\n    port: 5984\n...\n
\n

\nThe following code loads the customer section into the CONFIG variable:\n

\n

\nvar CONFIG = require('config').customer;\n...\nnewCustomer.creditLimit = CONFIG.initialCredit;\ndatabase.open(CONFIG.db.name, CONFIG.db.port);\n...\n
"}, "ProtectedTest": {"name": "ProtectedTest", "namespace": "", "module": "test", "guessedname": "PrivateTest", "file": "1-protected-test.js", "guessedtype": "property", "shortname": "ProtectedTest", "description": "

Tests for underlying node-config utilities. To run type:

\n
npm test config
"}}, "version": "0.4.18", "modules": {"test": {"description": "

Unit tests

", "submodules": [], "classlist": ["ProtectedTest", "ConfigTest"], "filelist": ["1-protected-test.js", "2-config-test.js", "default.js"], "subdata": {}, "name": "test"}, "config": {"description": "

Runtime Application Configurations

\n

\nThe config module exports a singleton object representing all runtime\nconfigurations for this application deployment.\n

\n

\nApplication configurations are stored in files within the config directory\nof your application. The default configuration file is loaded, followed\nby files specific to the deployment type (development, testing, staging,\nproduction, etc.).\n

\n

\nFor example, with the following config/default.yaml file:\n

\n
\n...\ncustomer:\n  initialCredit: 500\n  db:\n    name: customer\n    port: 5984\n...\n
\n

\nThe following code loads the customer section into the CONFIG variable:\n

\n

\nvar CONFIG = require('config').customer;\n...\nnewCustomer.creditLimit = CONFIG.initialCredit;\ndatabase.open(CONFIG.db.name, CONFIG.db.port);\n...\n
", "submodules": [], "classlist": ["Config"], "filelist": ["config.js"], "subdata": {}, "name": "config"}}, "filemap": {"default.js": {"classlist": [], "name": "default.js", "module": "test"}, "2-config-test.js": {"classlist": ["ConfigTest"], "name": "2-config-test.js", "module": "test"}, "config.js": {"classlist": ["Config"], "name": "config.js", "module": "config"}, "1-protected-test.js": {"classlist": ["ProtectedTest"], "name": "1-protected-test.js", "module": "test"}}} \ No newline at end of file