sensu / sensu-go

Simple. Scalable. Multi-cloud monitoring.
https://sensu.io
MIT License
1.01k stars 177 forks source link

CLI: User-specific configuration paths #170

Closed amdprophet closed 7 years ago

amdprophet commented 7 years ago

We need to decide on where we store user-specific configuration, data, and cache for applications such as sensu-cli.

I believe that we've figured out what the paths will be on Windows & Linux (I'd still love feedback) but I'm conflicted on which direction we should take for macOS.

I'm hoping to get some opinions from everyone so that we can get a sense of what people prefer.

Just as a note, all of these defaults should/will be able to be overridden with various environment variables.

amdprophet commented 7 years ago

Linux/BSD

$XDG_CONFIG_HOME/sensu/sensu-cli

$XDG_CACHE_HOME/sensu/sensu-cli

$XDG_DATA_HOME/sensu/sensu-cli

$XDG_RUNTIME_DIR/sensu/sensu-cli

NOTE As $XDG_RUNTIME_DIR does not have a default, it seems that people will sometimes use patterns similar to /tmp/servicename-$USER but systemd-based distros require the directories to exist in /run/user/$USER/service.

Read more: https://wiki.archlinux.org/index.php/XDG_Base_Directory_support

Why?

If you're happy with this proposal vote with a :+1: otherwise vote with a :-1:

amdprophet commented 7 years ago

Windows

%APPDATA%\sensu\sensu-cli

%LOCALAPPDATA%\sensu\sensu-cli

%LOCALAPPDATA%\sensu\sensu-cli\cache

Why?

If you're happy with this proposal vote with a :+1: otherwise vote with a :-1:

amdprophet commented 7 years ago

macOS

Please suggest additional pros & cons if you feel I've left something out.

1. Use the same paths as Linux (XDG)

A few pros

A few cons

2. Use the paths that Apple wants developers to use

As per Apple's Recommendations:

$HOME/Library/Application support/sensu/sensu-cli

$HOME/Library/Caches/sensu/sensu-cli

NOTE In the case of sensu-cli:

A few pros

A few cons

Read more: https://developer.apple.com/library/content/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/FileSystemOverview/FileSystemOverview.html

Vote with 🎉 for using the XDG standard and :heart: for using macOS standard

amdprophet commented 7 years ago

I voted for the macOS standard as I personally feel that adhering to the various principles in each OS will make us more responsible members of each community. We implemented many of the OS guidelines with the ruby-based Sensu software on macOS, FreeBSD, Solaris, and AIX. Now that we no longer have a dependency on ruby I'm positive that we can do an even better job.

jamesdphillips commented 7 years ago

My argument against it would be that it's:

amdprophet commented 7 years ago

@calebhailey suggested the following when we last spoke:

  1. Try to load from ~/Library/Application Support/sensu first.

  2. If no config exists, fallback to the XDG config path.

  3. By default, creating a new profile/config will create files in Apple's path.

  4. If no config exists in Apple's path but does exist in XDG path, save future configs / changes to the XDG path.

If we only want to deal with one specification we'll need to determine the following:

amdprophet commented 7 years ago

After thinking about this a bit more, I think we should just use the XDG path for configs and Apple path for cache.

If we ever release a Mac GUI app we can just add import functionality for configs / credentials.

jamesdphillips commented 7 years ago

burns-excellent