• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript nconf.argv函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中nconf.argv函数的典型用法代码示例。如果您正苦于以下问题:TypeScript argv函数的具体用法?TypeScript argv怎么用?TypeScript argv使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了argv函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: run

async function run() {
    // Load configuration
    nconf.argv()
        .env({ separator: "_" })
        .file("user", { file: process.env.SMU_CONFIG || "/etc/smu.yml", format: nconfYaml })
        .file("defaults", { file: join(__dirname, "../conf/defaults.yml"), format: nconfYaml });

    const config = nconf.get(null);

    // Initialize Hapi
    const server = promisify(new hapi.Server());
    server.connection(config.server);

    // init server
    try {
        await server.register(plugins);
        setupAuthentication(server, config.authentication);
        setupCommands(server, config.commands);
        await server.start();
    } catch (err) {
        server.log(["error"], "Error starting server: " + err);
        process.exit(1);
    }
    server.log(["info"], `Server running at: ${server.info.uri}`);
}
开发者ID:msurdi,项目名称:smu,代码行数:25,代码来源:index.ts


示例2: load

    @InitPhase
    @ReturnsService('config')
    load() {
        nconf
          .argv()
          .env()
          .file({ file: 'config/config.json' })
          .file({ file: 'config/local.json' });

        return nconf;
    }
开发者ID:HallM,项目名称:poc-fw2,代码行数:11,代码来源:index.ts


示例3: Run

function Run(): void {
    // #1 Command-line arguments
    nconf.argv();
    // #2 Environment variables
    nconf.env();
    // #3 A file located at '{.}config.json'
    nconf.file({
        file: "./config.json"
    });
    // #4 Defaults
    // default name for Azure Store Table
    nconf.defaults({
        "Azure:Store:TableName": "table-name"
    });
    console.log(JSON.stringify(nconf.get(null), null, "\t"));
}
开发者ID:samelamin,项目名称:azure-nodejs-examples,代码行数:16,代码来源:index.ts


示例4: constructor

  constructor() {
    nconf
      .argv()
      .env({
        separator: '__'
      });

    nconf.defaults({
      'NODE_ENV': 'development'
    });

    const environment = nconf.get('NODE_ENV');
    const configDir = path.join(__dirname, '..', '..', '..', '..', 'config');

    nconf.file(environment, path.join(configDir, `${environment}.json`));
    nconf.file('default', path.join(configDir, 'default.json'));
  }
开发者ID:vmlf01,项目名称:ts-painters-node,代码行数:17,代码来源:Config.ts


示例5: require

import * as assert from 'assert';
import * as path from 'path'

import * as engine from "../Engine"
import * as providers from "../Providers"

import { TicketState } from '../Models/ticketState';
import { ItemType } from '../Models/itemType';
import { ArtifactDownloadTicket } from '../Models/artifactDownloadTicket';

var nconf = require('nconf');

nconf.argv()
    .env()
    .file(__dirname + '/../test.config.json');

describe('Perf Tests', () => {
    describe('fileshare perf tests', () => {
        var runWindowsBasedTest = process.platform == 'win32' ? it : it.skip;
        //Artifact details => Source: FileShare, FilesCount: 301, TotalFileSize: 1.7GB
        runWindowsBasedTest('should be able to download large size build artifact from fileshare', function (done) {
            this.timeout(900000);   //15mins
            let processor = new engine.ArtifactEngine();

            let processorOptions = new engine.ArtifactEngineOptions();
            processorOptions.itemPattern = "**";
            processorOptions.parallelProcessingLimit = 64;
            processorOptions.retryIntervalInSeconds = 2;
            processorOptions.retryLimit = 4;
            processorOptions.verbose = true;
开发者ID:Microsoft,项目名称:vsts-rm-extensions,代码行数:30,代码来源:fileshare.perf.ts


示例6: require

const bodyParser = require('body-parser');
const helmet = require('helmet');
const morgan = require('morgan'); // HTTP request Logger middleware for node.js
const winston = require('winston'); // Logger
const localization = require('i18n');
const path = require('path');
const nunjucks = require('nunjucks');
const cookieParser = require('cookie-parser');
const favicon = require('serve-favicon');
const nconf = require('nconf');

// Setup nconf to use (in-order):
//   1. Command-line arguments
//   2. Environment variables
//   3. A file located at './config.json'
nconf.argv().env().file({ file: './config.json' });
nconf.defaults({
  'NODE_ENV': 'development',
  'NODE_PATH': '.',
  'PORT': 3000,

  // custom flags
  'appName': 'NodeExample',
  'logLevel': 'warn',
  'logInJson': false,
  'lang': 'en-US'
});

// Environment variables
const ROOT: string = nconf.get('NODE_PATH');
const ENV: string = nconf.get('NODE_ENV');
开发者ID:melxx001,项目名称:simple-nodejs-typescript-starter,代码行数:31,代码来源:server.ts


示例7: Promise

import * as fs from "fs";
import * as nconf from "nconf";
import {defaults} from "./defaults";
import * as configs from "./env";

/**
 * Create app configuration
 */
export var config = {
    // environment specific options
    for: (env) => {
        env = env.toLowerCase().trim();
        return new Promise((resolve, reject) => {
            nconf.overrides(configs[env]);             
            // do some async stuff if needed           
            resolve();
        });
    },
    // not chengable options
    get configure() {
        nconf.argv().env();
        nconf.defaults(defaults);
        nconf.file("app", {
            file: 'config.json',
            dir: __dirname,
            search: true
        });
        return this;
    }
};  
开发者ID:cm0s,项目名称:mea2n,代码行数:30,代码来源:config.ts


示例8: require

import * as Discover from "./discover";

var program = require('commander');
var nconf = require('nconf');

program
  .version('0.0.1')
  .option('--acceptor_name [name]', 'Acceptor name',names.generateName().substr(0, 15))
  .option('--leader_name [name]', 'Leader name', names.generateName().substr(0, 15))
  .option('--replica_name [name]', 'replica_name', names.generateName().substr(0, 15))
  .option('--conf [configuration]', 'configuration file')
  .parse(process.argv);


if(program['conf'])
  nconf.argv().env().file({file: program['conf']});
else{
  nconf.argv()
       .env()
       .file({ file: '/etc/icarus/icarus.conf'})
       .file({ file: './conf/icarus.conf' })
}

function capitalize(string) {
  return string.charAt(0).toUpperCase() + string.slice(1);
}

function createDiscover(type:string, name:string, rol:any){
  let roles = {}
  roles[process.env.rol[0].toUpperCase()] = []
  for (let ports in rol['ports']){
开发者ID:Villaz,项目名称:Icarus,代码行数:31,代码来源:app.ts



注:本文中的nconf.argv函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript nconf.defaults函数代码示例发布时间:2022-05-25
下一篇:
TypeScript widget.NotebookMergeWidget类代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap