mirror of
https://github.com/mtan93/homebridge.git
synced 2026-03-21 13:20:56 +00:00
Provider config and cli-based setup
This commit is contained in:
31
lib/user.js
Normal file
31
lib/user.js
Normal 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");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user