From: Michael Orlitzky Date: Wed, 18 Dec 2013 08:11:30 +0000 (-0500) Subject: Allow a global /etc/htsnrc to override the user's ~/.htsnrc. X-Git-Tag: 0.0.2~42 X-Git-Url: http://gitweb.michael.orlitzky.com/?p=dead%2Fhtsn.git;a=commitdiff_plain;h=3fbc7d861d1f95513151010cd0f2d620befc2870;hp=eab42a8effc71f75a585a540d92c9dd295c7c9c9 Allow a global /etc/htsnrc to override the user's ~/.htsnrc. --- diff --git a/doc/htsnrc.example b/doc/htsnrc.example index 18a5a3b..ed47402 100644 --- a/doc/htsnrc.example +++ b/doc/htsnrc.example @@ -1,5 +1,6 @@ # Example configuration file for htsn. For this to take effect, you -# would need to place it in $HOME/.htsnrc +# would need to place it in either /etc/htsnrc or $HOME/.htsnrc. The +# latter overrides the former. # The username used to connect to the feed. # diff --git a/src/OptionalConfiguration.hs b/src/OptionalConfiguration.hs index 7ed63c5..ea7a678 100644 --- a/src/OptionalConfiguration.hs +++ b/src/OptionalConfiguration.hs @@ -69,7 +69,8 @@ instance Monoid OptionalConfiguration where from_rc :: IO OptionalConfiguration from_rc = do - cfg <- DC.load [ DC.Optional "$(HOME)/.htsnrc" ] + cfg <- DC.load [ DC.Optional "/etc/htsnrc", + DC.Optional "$(HOME)/.htsnrc" ] cfg_password <- DC.lookup cfg "password" cfg_output_directory <- DC.lookup cfg "output_directory" cfg_username <- DC.lookup cfg "username"