summaryrefslogtreecommitdiff
path: root/src/Propellor/Property/Apache.hs
diff options
context:
space:
mode:
authorJoey Hess <joeyh@joeyh.name>2017-03-08 16:21:55 -0400
committerJoey Hess <joeyh@joeyh.name>2017-03-08 16:21:55 -0400
commit8b973f3acaf3075b836973d0e0d5d26ac6b0d362 (patch)
treecc4b14a6c748704264e87e2ca3289befbdeac900 /src/Propellor/Property/Apache.hs
parent2c31193b3345bc1f872b1e59ae146a2e8a33401a (diff)
parent75d47168dc4e0cbe67d1a2f0223a43f2a45da06d (diff)
Merge branch 'joeyconfig'
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,