'use strict';

/*eslint no-console: [0] */

var path = require('path');
var existsSync = require('exists-sync');

function readConfigFromDisk(options) {
  var providedConfigPath = options.configPath;
  var defaultConfigPath = providedConfigPath || path.join(process.cwd(), '.template-lintrc');
  var overrideConfigPath = process.env['TEMPLATE_LINTRC'];
  var configPath = overrideConfigPath || defaultConfigPath;

  if(existsSync(configPath) || existsSync(configPath + '.js') || existsSync(configPath + '.json')) {
    return require(configPath);
  } else {
    return {};
  }
}

module.exports = function(options) {
  var config = options.config || readConfigFromDisk(options);

  return config;
};

'use strict';

var path = require('path');
var existsSync = require('exists-sync');

function readConfigFromDisk(options) {
  var providedConfigPath = options.configPath;
  var configPath = providedConfigPath || path.join(process.cwd(), '.template-lintrc');

  if(existsSync(configPath) || existsSync(configPath + '.js') || existsSync(configPath + '.json')) {
    return require(configPath);
  } else {
    return {};
  }
}

module.exports = function(options) {
  var config = options.config || readConfigFromDisk(options);

  return config;
};

Remove support for environment variable override.
Remove support for environment variable override.

We can add support back if needed, but it makes the config parsing a bit
more annoying for now...
