Provider config and cli-based setup

This commit is contained in:
Nick Farina
2015-07-15 22:36:45 -07:00
parent 6afff4f3e4
commit 5611e38beb
13 changed files with 233 additions and 137 deletions

31
lib/user.js Normal file
View File

@@ -0,0 +1,31 @@
import path from 'path';
import fs from 'fs';
import { Config } from './config';
//
// Manages user settings and storage locations.
//
// global cached config
let config:Config;
export class User {
static get config():Config {
return config || (config = Config.load(User.configPath));
}
static get storagePath():string {
let home = process.env.HOME || process.env.HOMEPATH || process.env.USERPROFILE;
return path.join(home, ".homebridge");
}
static get configPath():string {
return path.join(User.storagePath, "config.json");
}
static get providersPath():string {
return path.join(User.storagePath, "providers");
}
}