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

TypeScript config.get函数代码示例

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

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



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

示例1: mount

import * as Koa from 'koa';
import * as KoaRouter from 'koa-trie-router';
import * as config from 'config';
import * as _mount from 'koa-mount';

const APP_CONFIG = config.get('app');

export class BaseHandler {
  protected router: KoaRouter;
  protected app: Koa;
  public mount_path: string;

  constructor(app: Koa, prefix) {
    this.app = app;
    this.mount_path = APP_CONFIG.namespace + prefix;
    this.router = new KoaRouter(this.mount_path);
  }

  protected mount() {
    this.app.use(_mount(this.mount_path, this.router.middleware()));
  }
}
开发者ID:HackrLabs,项目名称:HakrPass,代码行数:22,代码来源:base-handler.ts


示例2: it

import * as config from 'config'
import { expect } from 'chai'
import { Request } from 'express'

import { JwtExtractor } from 'idam/jwtExtractor'

const sessionCookieName = config.get<string>('session.cookieName')

describe('Extracting JWT', () => {
  it('should return token from cookie', () => {
    const jwtValue = 'a'

    const req = {
      cookies: {
        [sessionCookieName]: jwtValue
      }
    } as Request

    expect(JwtExtractor.extract(req)).to.equal(jwtValue)
  })
})
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:21,代码来源:jwtExtractor.ts


示例3:

 .get(Paths.mcolEligibilityPage.uri, (req: express.Request, res: express.Response): void => {
   res.render(Paths.mcolEligibilityPage.associatedView, {
     mcolUrl: config.get<string>('mcol.url')
   })
 })
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:5,代码来源:mcol-eligibility.ts


示例4: toBoolean

 .some((featureName) => toBoolean(config.get<boolean>(`featureToggles.${featureName}`)))
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:1,代码来源:featureToggles.ts


示例5: getRandomInt

import Utils from './utils'
import Requests from './requests'
import * as config from 'config'

// get token from https://steamcommunity.com/saliengame/gettoken
// can add many user
const userList = config.get('token')

let singleton: boolean = false
if (userList.length === 1) {
    singleton = true
}

function getRandomInt(min: number, max: number): number {
    min = Math.ceil(min)
    max = Math.floor(max)
    return Math.floor(Math.random() * (max - min)) + min
}

async function SteamGame(userToken: string) {
    let loggerName = `Saliens (${userToken})`
    if (singleton) {
        loggerName = `Saliens`
    }

    const logger = new Utils.Logger(Utils.Logger.LEVEL_INFO, loggerName)
    const requests = new Requests.SalienGame(userToken, logger)
    let times = 0

    while (true) {
        const bossPlanet = await requests.getBossPlanet()
开发者ID:Indexyz,项目名称:steam_2018_summer_game,代码行数:31,代码来源:index.ts


示例6: getLocalConfigFilePath

  'activitypub-http-fetcher': 1,
  'video-file': 1,
  'email': 5
}
// 2 days
const JOB_COMPLETED_LIFETIME = 60000 * 60 * 24 * 2

// 1 hour
let SCHEDULER_INTERVAL = 60000 * 60

// ---------------------------------------------------------------------------

const CONFIG = {
  CUSTOM_FILE: getLocalConfigFilePath(),
  LISTEN: {
    PORT: config.get<number>('listen.port')
  },
  DATABASE: {
    DBNAME: 'peertube' + config.get<string>('database.suffix'),
    HOSTNAME: config.get<string>('database.hostname'),
    PORT: config.get<number>('database.port'),
    USERNAME: config.get<string>('database.username'),
    PASSWORD: config.get<string>('database.password')
  },
  REDIS: {
    HOSTNAME: config.get<string>('redis.hostname'),
    PORT: config.get<number>('redis.port'),
    AUTH: config.get<string>('redis.auth')
  },
  SMTP: {
    HOSTNAME: config.get<string>('smtp.hostname'),
开发者ID:quoidautre,项目名称:PeerTube,代码行数:31,代码来源:constants.ts


示例7: next

import * as Koa from 'koa';
import * as Router from 'koa-trie-router';
import * as bodyparser from 'koa-bodyparser';
import * as config from 'config';
import * as jwt from 'jsonwebtoken';
import * as mount from 'koa-mount';
import * as responseTime from 'koa-response-time';
import { UserService } from './routes/users/user.service';
import { BindRoutes } from './routes';

const APP_CONFIG = config.get('app');
const JWT_CONFIG = config.get('jwt');
const app = new Koa();
const userService = new UserService();

// X-Response-Time
app.use(responseTime());

// Body Parsing
app.use(bodyparser());

// 404 Handler
app.use(async (ctx, next) => {
  await next();
  if (ctx.status === 404) {
    ctx.response.status = 404;
    ctx.response.body = {
      error: true,
      message: 'Entity not found'
    };
  }
开发者ID:HackrLabs,项目名称:HakrPass,代码行数:31,代码来源:server.ts


示例8: read

import * as config from 'config'
import * as express from 'express'
import * as _ from 'lodash'

import { Eligibility } from 'eligibility/model/eligibility'

const minuteInMilliseconds = 60 * 1000
const cookieTimeToLiveInMinutes = config.get<number>('eligibility.cookie.timeToLiveInMinutes') * minuteInMilliseconds

export const cookieName = 'eligibility-check'

export class CookieEligibilityStore {
  read (req: express.Request, res: express.Response): Eligibility {
    const cookie: string = req.cookies[cookieName]
    return new Eligibility().deserialize(cookie !== undefined ? cookie : undefined)
  }

  write (eligibility: Eligibility, req: express.Request, res: express.Response): void {
    const excludeDisplayValue = (value: any): any | undefined => {
      const property = 'displayValue'

      if (value && typeof value === 'object' && Object.getOwnPropertyDescriptor(value, property)) {
        return _.omit(value, property)
      }
      return undefined
    }
    res.cookie(cookieName, _.cloneDeepWith(eligibility, excludeDisplayValue), { httpOnly: true, secure: true, maxAge: cookieTimeToLiveInMinutes })
  }

  clear (req: express.Request, res: express.Response): void {
    res.clearCookie(cookieName)
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:31,代码来源:store.ts


示例9:

import * as mock from 'nock'
import * as HttpStatus from 'http-status-codes'
import * as config from 'config'

const baseURL = config.get<string>('pay.url')
const endpointPath = '/card-payments'
const paymentsPath = '/payments'

export const paymentInitiateResponse: object = {
  reference: 'RC-1520-4225-4161-2265',
  date_created: '2018-03-07T11:35:42.095+0000',
  status: 'Initiated',
  _links: {
    next_url: {
      href: 'https://www.payments.service.gov.uk/secure/8b647ade-02cc-4c85-938d-4db560404df8',
      method: 'GET'
    }
  }
}

const paymentRetrieveResponse: object = {
  amount: 60,
  description: 'Money Claim issue fee',
  reference: 'RC-1520-4276-0065-8715',
  currency: 'GBP',
  ccd_case_number: 'UNKNOWN',
  case_reference: 'dfd75bac-6d54-4c7e-98f7-50e047d7c7f5',
  channel: 'online',
  method: 'card',
  external_provider: 'gov pay',
  status: 'Success',
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:31,代码来源:pay.ts


示例10: callback

 authenticate: (socket, data: {username: string, password: string}, callback) => {
     return callback(null, data.password === config.get('webPass'))
 }
开发者ID:Indexyz,项目名称:steam_2018_summer_game,代码行数:3,代码来源:web.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
TypeScript config.has函数代码示例发布时间:2022-05-25
下一篇:
TypeScript confidence.Store类代码示例发布时间: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