]> gitweb.michael.orlitzky.com - dead/htsn.git/commitdiff
Allow a global /etc/htsnrc to override the user's ~/.htsnrc.
authorMichael Orlitzky <michael@orlitzky.com>
Wed, 18 Dec 2013 08:11:30 +0000 (03:11 -0500)
committerMichael Orlitzky <michael@orlitzky.com>
Wed, 18 Dec 2013 08:11:30 +0000 (03:11 -0500)
doc/htsnrc.example
src/OptionalConfiguration.hs

index 18a5a3be3b60a81c811b3410c4a4663a0ca248b4..ed47402da96aea2f5340c6c7897a57ad62f5c687 100644 (file)
@@ -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.
 #
index 7ed63c5af0db27b6b4b3cb8661fee0e1c5ce1792..ea7a67830dd280cf2dbe7380e74b824b16d24d4d 100644 (file)
@@ -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"