nconf.html
6.06 KB
<!DOCTYPE html> <html> <head> <title>nconf.js</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" media="all" href="docco.css" /> </head> <body> <div id="container"> <div id="background"></div> <div id="jump_to"> Jump To … <div id="jump_wrapper"> <div id="jump_page"> <a class="source" href="nconf/common.html"> nconf/common.html </a> <a class="source" href="nconf/formats.html"> nconf/formats.html </a> <a class="source" href="nconf/provider.html"> nconf/provider.html </a> <a class="source" href="nconf/stores/file.html"> nconf/stores/file.html </a> <a class="source" href="nconf/stores/memory.html"> nconf/stores/memory.html </a> <a class="source" href="nconf/stores/system.html"> nconf/stores/system.html </a> <a class="source" href="nconf/stores.html"> nconf/stores.html </a> <a class="source" href="nconf.html"> nconf.html </a> </div> </div> </div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> nconf.js </h1> </th> <th class="code"> </th> </tr> </thead> <tbody> <tr id="section-1"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-1">¶</a> </div> </td> <td class="code"> <div class="highlight"><pre><span class="cm">/*</span>
<span class="cm"> * nconf.js: Top-level include for the nconf module</span>
<span class="cm"> *</span>
<span class="cm"> * (C) 2011, Charlie Robbins</span>
<span class="cm"> *</span>
<span class="cm"> */</span>
<span class="kd">var</span> <span class="nx">fs</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">'fs'</span><span class="p">),</span>
<span class="nx">async</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">'async'</span><span class="p">),</span>
<span class="nx">common</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">'./nconf/common'</span><span class="p">),</span>
<span class="nx">Provider</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">'./nconf/provider'</span><span class="p">).</span><span class="nx">Provider</span><span class="p">,</span>
<span class="nx">nconf</span> <span class="o">=</span> <span class="nx">module</span><span class="p">.</span><span class="nx">exports</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Provider</span><span class="p">();</span></pre></div> </td> </tr> <tr id="section-2"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-2">¶</a> </div> <p>Expose the version from the package.json using <code>pkginfo</code>.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nx">require</span><span class="p">(</span><span class="s1">'pkginfo'</span><span class="p">)(</span><span class="nx">module</span><span class="p">,</span> <span class="s1">'version'</span><span class="p">);</span></pre></div> </td> </tr> <tr id="section-3"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-3">¶</a> </div> <p>Expose the various components included with nconf</p> </td> <td class="code"> <div class="highlight"><pre><span class="nx">nconf</span><span class="p">.</span><span class="nx">key</span> <span class="o">=</span> <span class="nx">common</span><span class="p">.</span><span class="nx">key</span><span class="p">;</span>
<span class="nx">nconf</span><span class="p">.</span><span class="nx">path</span> <span class="o">=</span> <span class="nx">common</span><span class="p">.</span><span class="nx">path</span><span class="p">;</span>
<span class="nx">nconf</span><span class="p">.</span><span class="nx">loadFiles</span> <span class="o">=</span> <span class="nx">common</span><span class="p">.</span><span class="nx">loadFiles</span><span class="p">;</span>
<span class="nx">nconf</span><span class="p">.</span><span class="nx">loadFilesSync</span> <span class="o">=</span> <span class="nx">common</span><span class="p">.</span><span class="nx">loadFilesSync</span><span class="p">;</span>
<span class="nx">nconf</span><span class="p">.</span><span class="nx">formats</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">'./nconf/formats'</span><span class="p">);</span>
<span class="nx">nconf</span><span class="p">.</span><span class="nx">stores</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">'./nconf/stores'</span><span class="p">);</span>
<span class="nx">nconf</span><span class="p">.</span><span class="nx">Provider</span> <span class="o">=</span> <span class="nx">Provider</span><span class="p">;</span>
</pre></div> </td> </tr> </tbody> </table> </div> </body> </html>