moose-team / friends

:tv: P2P chat powered by the web.
http://moose-team.github.io/friends/
MIT License
3.17k stars 341 forks source link

centralize config, store db & keys in config path #162

Closed ungoldman closed 8 years ago

ungoldman commented 8 years ago

using application-config-path@^0.1.0 for OS-friendly config path

note this means if you want to keep history you need to copy friendsdb and public-keys from the project directory to the application config path, which will be...

Platform Location
OS X ~/Library/Application Support/Friends/
Linux (XDG) $XDG_CONFIG_HOME/Friends/
Linux (Legacy) ~/.config/Friends/
Windows (> Vista) %LOCALAPPDATA%/Friends/
Windows (XP, 2000) %USERPROFILE%/Local Settings/Application Data/Friends/

edit: removed config.json from table (this is copied from https://github.com/LinusU/node-application-config).

ungoldman commented 8 years ago

merging, review welcome

beaugunderson commented 8 years ago

i like the idea, though i like to use $XDG_CONFIG_PATH on OS X as well... probably not a big deal though? (people can always symlink)

ungoldman commented 8 years ago

@beaugunderson what is $XDG_CONFIG_PATH used for in OS X? This PR is based on what we did in https://github.com/feross/webtorrent-app/blob/master/config.js and the config path is determined by https://github.com/LinusU/node-application-config-path.

beaugunderson commented 8 years ago

whatever the user sets it to (~/.config in my case)

ungoldman commented 8 years ago

Yeah I guess my instinct is to just use the standard config path for the OS and let users override if they really want to. Would you want Friends to test for an env var before setting CONFIG_PATH?