mirror of
https://github.com/mtan93/homebridge.git
synced 2026-03-08 05:31:55 +00:00
32 lines
634 B
JavaScript
32 lines
634 B
JavaScript
import path from 'path';
|
|
import fs from 'fs';
|
|
import { Config } from './config';
|
|
|
|
//
|
|
// Manages user settings and storage locations.
|
|
//
|
|
|
|
// global cached config
|
|
let config;
|
|
|
|
export class User {
|
|
|
|
static get config() {
|
|
return config || (config = Config.load(User.configPath));
|
|
}
|
|
|
|
static get storagePath() {
|
|
let home = process.env.HOME || process.env.HOMEPATH || process.env.USERPROFILE;
|
|
return path.join(home, ".homebridge");
|
|
}
|
|
|
|
static get configPath() {
|
|
return path.join(User.storagePath, "config.json");
|
|
}
|
|
|
|
static get providersPath() {
|
|
return path.join(User.storagePath, "providers");
|
|
}
|
|
}
|
|
|