summaryrefslogtreecommitdiff
path: root/src/Propellor/Property/Tor.hs
diff options
context:
space:
mode:
authorJoey Hess2015-08-25 11:55:04 -0700
committerJoey Hess2015-08-25 11:55:04 -0700
commit7b1c20f2297987b641588c21e4f650347ee7c389 (patch)
tree315778d166133fe74632a6d3c5b7eee343e43792 /src/Propellor/Property/Tor.hs
parentd3ca52d29dfd3c81d19a50ebf2fd0fb6ff92d8c9 (diff)
parent2d5dae129a29990f182104840c58249443a11cf3 (diff)
Merge branch 'joeyconfig'
Diffstat (limited to 'src/Propellor/Property/Tor.hs')
-rw-r--r--src/Propellor/Property/Tor.hs17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/Propellor/Property/Tor.hs b/src/Propellor/Property/Tor.hs
index f1aaeeb1..535da951 100644
--- a/src/Propellor/Property/Tor.hs
+++ b/src/Propellor/Property/Tor.hs
@@ -4,6 +4,7 @@ import Propellor
import qualified Propellor.Property.File as File
import qualified Propellor.Property.Apt as Apt
import qualified Propellor.Property.Service as Service
+import qualified Propellor.Property.ConfFile as ConfFile
import Utility.FileMode
import Utility.DataUnits
@@ -112,11 +113,17 @@ hiddenServiceAvailable hn port = hiddenServiceHostName $ hiddenService hn port
return r
hiddenService :: HiddenServiceName -> Int -> Property NoInfo
-hiddenService hn port = configured
- [ ("HiddenServiceDir", varLib </> hn)
- , ("HiddenServicePort", unwords [show port, "127.0.0.1:" ++ show port])
- ]
- `describe` unwords ["hidden service available:", hn, show port]
+hiddenService hn port = ConfFile.adjustSection
+ (unwords ["hidden service", hn, "available on port", show port])
+ (== oniondir)
+ (not . isPrefixOf "HiddenServicePort")
+ (const [oniondir, onionport])
+ (++ [oniondir, onionport])
+ mainConfig
+ `onChange` restarted
+ where
+ oniondir = unwords ["HiddenServiceDir", varLib </> hn]
+ onionport = unwords ["HiddenServicePort", show port, "127.0.0.1:" ++ show port]
hiddenServiceData :: IsContext c => HiddenServiceName -> c -> Property HasInfo
hiddenServiceData hn context = combineProperties desc