Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Kibana.js file for azure websites
#!/usr/bin/env node
var program = require('commander');
var env = (process.env.NODE_ENV) ? process.env.NODE_ENV : 'development';
var path = require('path');
//PATH UPDATE - removed '..'
var packagePath = path.resolve(__dirname, '..', '..', 'package.json');
var fs = require('fs');
if (env !== 'development') {
//PATH UPDATE - removed '..'
packagePath = path.resolve(__dirname, 'package.json');
var package = require(packagePath);
program.description('Kibana is an open source (Apache Licensed), browser based analytics and search dashboard for Elasticsearch.');
program.option('-e, --elasticsearch <uri>', 'Elasticsearch instance');
program.option('-c, --config <path>', 'Path to the config file');
program.option('-p, --port <port>', 'The port to bind to', parseInt);
program.option('-q, --quiet', 'Turns off logging');
program.option('-H, --host <host>', 'The host to bind to');
program.option('--plugins <path>', 'Path to scan for plugins');
// This needs to be set before the config is loaded. CONFIG_PATH is used to
// override the kibana.yml config path which gets read when the config/index.js
// is parsed for the first time.
if (program.config) {
process.env.CONFIG_PATH = program.config;
// This needs to be set before the config is loaded. PLUGINS_PATH is used to
// set the external plugins folder.
if (program.plugins) {
process.env.PLUGINS_FOLDER = program.plugins;
// Load the config
var config = require('./config');
if (program.elasticsearch) {
config.elasticsearch = program.elasticsearch;
if (program.port) {
config.port = program.port;
if (program.quiet) {
config.quiet = program.quiet;
if ( { =;
//Update config to use Azure Websites injected vaiables
if (process.env.PORT) {
config.port = process.env.PORT;
if (process.env.HOST) { = process.env.HOST;
// Load and start the server. This must happen after all the config changes
// have been made since the server also requires the config.
//PATH UPDATE - removed '.'
var server = require('./');
//PATH UPDATE - removed '.'
var logger = require('./lib/logger');
server.start(function (err) {
// If we get here then things have gone sideways and we need to give up.
if (err) {
logger.fatal({ err: err });
if (config.kibana.pid_file) {
return fs.writeFile(config.kibana.pid_file,, function (err) {
if (err) {
logger.fatal({ err: err }, 'Failed to write PID file to %s', config.kibana.pid_file);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.