本文整理匯總了TypeScript中nconf.get函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript get函數的具體用法?TypeScript get怎麽用?TypeScript get使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了get函數的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: it
it('should be able to download jenkins artifact as zip', function (done) {
this.timeout(15000);
let processor = new engine.ArtifactEngine();
let processorOptions = new engine.ArtifactEngineOptions();
processorOptions.itemPattern = "**";
processorOptions.parallelProcessingLimit = 8;
processorOptions.retryIntervalInSeconds = 2;
processorOptions.retryLimit = 2;
processorOptions.verbose = true;
var itemsUrl = "http://rmcdpjenkins2.southindia.cloudapp.azure.com:8080/job/ReleaseManagement/job/RMCDP/job/ArtifactEngineTests/job/SmallProject/10/artifact/*zip*/";
var handler = new BasicCredentialHandler(nconf.get('JENKINS:USERNAME'), nconf.get('JENKINS:PASSWORD') || tl.getVariable('JENKINS:PASSWORD'));
var zipProvider = new providers.ZipProvider(itemsUrl, handler, { ignoreSslError: false });
var dropLocation = path.join(nconf.get('DROPLOCATION'), "jenkinsDropWithMultipleFiles.zip");
var filesystemProvider = new providers.FilesystemProvider(dropLocation);
processor.processItems(zipProvider, filesystemProvider, processorOptions)
.then((tickets) => {
fs.existsSync(path.join(nconf.get('DROPLOCATION'), 'jenkinsDropWithMultipleFiles.zip'));
assert.equal(tickets.find(x => x.artifactItem.path == "").retryCount, 0);
assert.notEqual(tickets.find(x => x.artifactItem.path == "").fileSizeInBytes, 0);
done();
}, (error) => {
throw error;
});
});
示例2: it
it('should be able to download jenkins artifact with large volume of files', function (done) {
this.timeout(1800000); //30mins
let processor = new engine.ArtifactEngine();
let processorOptions = new engine.ArtifactEngineOptions();
processorOptions.itemPattern = "**";
processorOptions.parallelProcessingLimit = 8;
processorOptions.retryIntervalInSeconds = 2;
processorOptions.retryLimit = 4;
processorOptions.verbose = true;
var itemsUrl = "http://rmcdpjenkins2.southindia.cloudapp.azure.com:8080/job/ReleaseManagement/job/RMCDP/job/ArtifactEngineTests/job/LargeVolumeProject/6/api/json?tree=artifacts[*]";
var variables = {
"endpoint": {
"url": "http://rmcdpjenkins2.southindia.cloudapp.azure.com:8080"
},
"definition": "ReleaseManagement/job/RMCDP/job/ArtifactEngineTests/job/LargeVolumeProject",
"version": "6"
};
var handler = new BasicCredentialHandler(nconf.get('JENKINS:USERNAME'), nconf.get('JENKINS:PASSWORD'));
var webProvider = new providers.WebProvider(itemsUrl, "jenkins.handlebars", variables, handler, { ignoreSslError: false });
var dropLocation = path.join(nconf.get('DROPLOCATION'), "jenkinsDropWithLargeVolumeFiles");
var filesystemProvider = new providers.FilesystemProvider(dropLocation);
processor.processItems(webProvider, filesystemProvider, processorOptions)
.then((tickets) => {
let fileTickets = tickets.filter(x => x.artifactItem.itemType == ItemType.File && x.state === TicketState.Processed);
assert.equal(fileTickets.length, 20377);
assert(getDownloadSizeInMB(fileTickets) > 20);
done();
}, (error) => {
throw error;
});
});
示例3: start
async function start() {
const server = new Hapi.Server();
const env = process.env.NODE_ENV || 'development';
process.env.NODE_ENV = env; //So the plugins load right
const configFilePath = path.join(__dirname, "config", env + ".json");
const userConfigFilePath = path.join(__dirname, "config", env + ".user.json");
nconf
.file("user_overrides", userConfigFilePath)
.file("defaults", configFilePath);
server.connection({
host: nconf.get('hapi:host'),
port: nconf.get('hapi:port')
});
const appLogger = new AppLogger();
server.app.logger = await appLogger.initialize(nconf);
await Plugin.registerAll(server, nconf);
await Api.loadRoutes(server);
await server.start();
if (server.info !== null) {
server.app.logger.info(`Server running at ${server.info.uri}`);
}
}
示例4: it
it('should be able to download build artifact with large volume of files from vsts drop', function (done) {
this.timeout(1800000); //30mins
let processor = new engine.ArtifactEngine();
let processorOptions = new engine.ArtifactEngineOptions();
processorOptions.itemPattern = "**";
processorOptions.parallelProcessingLimit = 64;
processorOptions.retryIntervalInSeconds = 2;
processorOptions.retryLimit = 4;
processorOptions.verbose = true;
var itemsUrl = "https://testking123.visualstudio.com/_apis/resources/Containers/1976011?itemPath=files20k&isShallow=false";
var variables = {};
var handler = new PersonalAccessTokenCredentialHandler(nconf.get('VSTS:PAT'));
var webProvider = new providers.WebProvider(itemsUrl, "vsts.handlebars", variables, handler, { ignoreSslError: false });
var dropLocation = path.join(nconf.get('DROPLOCATION'), "vstsDropWithLargeFiles");
var filesystemProvider = new providers.FilesystemProvider(dropLocation);
processor.processItems(webProvider, filesystemProvider, processorOptions)
.then((tickets) => {
let fileTickets = tickets.filter(x => x.artifactItem.itemType == ItemType.File && x.state === TicketState.Processed);
assert.equal(fileTickets.length, 20391);
assert(getDownloadSizeInMB(fileTickets) > 15);
done();
}, (error) => {
throw error;
});
});
示例5: sendResetMail
// send it
(emailContent, user, done) => {
sendResetMail(
user.email, // to
nconf.get("mailer").from, // from
emailContent, // what
nconf.get("mailer").options,// options
(err) => {
if (!err)
return res.status(200).send({ key: "info_password_change_mail_sent" });
done(err);
})
}
示例6: runWindowsBasedTest
runWindowsBasedTest('should be able to download build artifact from fileshare', function (done) {
this.timeout(15000);
let processor = new engine.ArtifactEngine();
let processorOptions = new engine.ArtifactEngineOptions();
processorOptions.itemPattern = "fileshareWithMultipleFiles\\**";
processorOptions.parallelProcessingLimit = 8;
processorOptions.retryIntervalInSeconds = 2;
processorOptions.retryLimit = 2;
processorOptions.verbose = true;
var itemsUrl = "//vscsstor/Users/gykuma/ArtifactEngineTestData/dropz/";
var variables = {};
var sourceProvider = new providers.FilesystemProvider(itemsUrl, "fileshareWithMultipleFiles");
var dropLocation = path.join(nconf.get('DROPLOCATION'));
var destProvider = new providers.FilesystemProvider(dropLocation);
processor.processItems(sourceProvider, destProvider, processorOptions)
.then((tickets) => {
fs.readFile(path.join(nconf.get('DROPLOCATION'), 'fileshareWithMultipleFiles/folder1/file2.txt'), 'utf8', function (err, data) {
if (err) {
throw err;
}
assert.equal(data, "dummyFolderContent");
done();
});
assert.equal(tickets.find(x => x.artifactItem.path == path.join("fileshareWithMultipleFiles", "file1.pdb")).retryCount, 0);
assert.equal(tickets.find(x => x.artifactItem.path == path.join("fileshareWithMultipleFiles", "folder1", "file2.txt")).retryCount, 0);
}, (error) => {
throw error;
});
});
示例7: HandleAsync
async HandleAsync(request: JoinIdeaRequest): Promise<JoinIdeaResponse> {
let businessRules = nconf.get("BusinessRules");
let idea = await this.GetIdea(request.ideaId);
if (idea.joinedList.length >= businessRules.MaxTeamSize) {
throw new Error(`This project already has ${businessRules.MaxTeamSize} team members. ` +
"Please select a different project.");
}
let ideas = await this.GetIdeasThatUserAlreadyJoined(request.user);
ideas.map(async (idea) => {
await this.UnJoinIdea(idea.id, request.user);
});
var index = _.findIndex(idea.joinedList, item => item.id === request.user.id);
if (index < 0) {
idea.joinedList.push({
id: request.user.id,
name: request.user.displayName,
login: request.user.username
});
}
await this.UpsertIdea(idea, request.user);
return new JoinIdeaResponse();
}
示例8: loadConfiguration
export function loadConfiguration() {
nconf.file({
file: fileName
});
const gpioConfigs = nconf.get('gpio');
const mockGpio = nconf.get('mock_gpio');
console.log('reading gpio configs, useMock:' + mockGpio);
console.log(JSON.stringify(gpioConfigs, null, 4));
return {
useMock: mockGpio,
configs: validateGpioConfigurations(gpioConfigs)
};
}
示例9: 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}`);
}