Closed samv closed 3 years ago
A better choice could be using freedesktop specifications for picking the configuration directory instead of littering the home folder with yet another configuration file. Referring to the standard it would be a path like ~/.config/lamp.conf
. Same approach can be applied to MacOS version of lamp as other UNIX programs like Alacritty do.
Hey @samv, thanks for feedbacks, we will validate your request with team, and we will inform you about process asap.
It's looking in
~/go/bin/conf/lamp.conf
by default on MacOS, presumably Linux, too. This should probably be~/.lamp.conf
by default.To get the home directory of a user, you can use
os.UserHomeDir()
oros/user.Current()
from stdlib. I would probably lean towards the former.That's the typical first place to look.
The current implementation looking at where the binary is being executed from, etc - this seems similar to some FHS behaviors as a fallback location if there is no user configuration file, but it should go up one directory, and the directory should be "etc" instead of "conf". There's a bunch of path manipulation there which should use functions like
path.Join
instead.The main reason for this is that the first time you install a program like this, you need to set it up and so it's not great if it doesn't tell you where to set the API token, where the file should be created, and how to set up the file.