import path from 'path';
import fs from 'fs-extra';

const defaultConfig = {
  plugins: [],
  localPlugins: []
};

let config = Object.assign({}, defaultConfig);

const configFile = path.join(__dirname, '../.rotonde.json');
const contents = fs.readFileSync(configFile, 'utf-8');
config = Object.assign({}, config, JSON.parse(contents));

/**
 * Returns the config.
 */
export function getConfig() {
  return config;
}

/**
 * Returns the path to the plugins directory.
 */
export function getPluginsDirectory() {
  return path.join(__dirname, '../.rotonde_plugins');
}

/**
 * Returns the list of plugins.
 */
export function getPlugins() {
  return getConfig().plugins;
}
@@ -1,12 +1,33 @@
+import os from 'os';%0A
 import path 
@@ -39,16 +39,16 @@
 'path';%0A
-
 import f
@@ -193,56 +193,182 @@
 nfig
-File = path.join(__dirname, '../.rotonde.json');
+Path = getConfigPath();%0Aconst configFileExists = fs.existsSync(configPath);%0Aif (!configFileExists) %7B%0A  fs.writeFileSync(configPath, JSON.stringify(defaultConfig, null, 2));%0A%7D
 %0Acon
@@ -403,20 +403,20 @@
 c(config
-File
+Path
 , 'utf-8
@@ -478,16 +478,289 @@
 nts));%0A%0A
+/**%0A * Returns the path to the config file.%0A */%0Afunction getConfigPath() %7B%0A  const configFile = '.rotonde.json';%0A  if (process.env.NODE_ENV === 'development') %7B%0A    return path.resolve(__dirname, %60../$%7BconfigFile%7D%60);%0A  %7D%0A  return path.resolve(os.homedir(), configFile);%0A%7D%0A%0A
 /**%0A * R

Read the config file from the home directory, if not running in development