summaryrefslogtreecommitdiff
path: root/src/Propellor/Property/Apache.hs
diff options
context:
space:
mode:
authorJoey Hess2017-03-08 14:02:31 -0400
committerJoey Hess2017-03-08 14:02:31 -0400
commit005e6985dca760bced6e6f2af5df4a0a5cadb0e3 (patch)
tree186adbcb15e9a63aa757d29860156642dbc9716f /src/Propellor/Property/Apache.hs
parente3cb320d1b2e000274ac0d61b48c2a57a08f1c89 (diff)
added Apache.confEnabled
Diffstat (limited to 'src/Propellor/Property/Apache.hs')
-rw-r--r--src/Propellor/Property/Apache.hs18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/Propellor/Property/Apache.hs b/src/Propellor/Property/Apache.hs
index d912acc1..554a5837 100644
--- a/src/Propellor/Property/Apache.hs
+++ b/src/Propellor/Property/Apache.hs
@@ -64,6 +64,24 @@ modEnabled modname = enable <!> disable
`onChange` reloaded
isenabled = boolSystem "a2query" [Param "-q", Param "-m", Param modname]
+-- | Control whether an apache configuration file is enabled.
+--
+-- The String is the base name of the configuration, eg "charset" or "gitweb".
+confEnabled :: String -> RevertableProperty DebianLike DebianLike
+confEnabled confname = enable <!> disable
+ where
+ enable = check (not <$> isenabled)
+ (cmdProperty "a2enconf" ["--quiet", confname])
+ `describe` ("apache configuration enabled " ++ confname)
+ `requires` installed
+ `onChange` reloaded
+ disable = check isenabled
+ (cmdProperty "a2disconf" ["--quiet", confname])
+ `describe` ("apache configuration disabled " ++ confname)
+ `requires` installed
+ `onChange` reloaded
+ isenabled = boolSystem "a2query" [Param "-q", Param "-c", Param confname]
+
-- | Make apache listen on the specified ports.
--
-- Note that ports are also specified inside a site's config file,