Files
homebridge/lib/user.js
Nick Farina dbedf7fe01 Convert to ES5, add web server
* No compilation step
 * Beginnings of web interface
 * Simple express server; React-based frontend
 * CommonJS style across codebase; auto-converts to RequireJS for browser
 * Using diffsync for realtime UI
 * "Provider" -> "Plugin"
 * Plugins expose one or more Providers
2015-08-11 22:27:59 -07:00

33 lines
601 B
JavaScript

var path = require('path');
var fs = require('fs');
var Config = require('./Config').Config;
'use strict';
module.exports = {
User: User
}
/**
* Manages user settings and storage locations.
*/
// global cached config
var config;
function User() {
}
User.config = function() {
return config || (config = Config.load(User.configPath()));
}
User.storagePath = function() {
var home = process.env.HOME || process.env.HOMEPATH || process.env.USERPROFILE;
return path.join(home, ".homebridge");
}
User.configPath = function() {
return path.join(User.storagePath(), "config.json");
}