summaryrefslogtreecommitdiff
path: root/Propellor/Property
diff options
context:
space:
mode:
authorJoey Hess2014-04-08 17:29:56 -0400
committerJoey Hess2014-04-08 17:29:56 -0400
commite435d97927d37fbea032b83e791dd77dcbd47307 (patch)
tree668637411bf5a343f64ced0da4e373c74ea7b969 /Propellor/Property
parent4ea2771b69617bc537687f9b2fec4b0a32880de5 (diff)
propellor spin
Diffstat (limited to 'Propellor/Property')
-rw-r--r--Propellor/Property/OpenId.hs13
1 files changed, 10 insertions, 3 deletions
diff --git a/Propellor/Property/OpenId.hs b/Propellor/Property/OpenId.hs
index 0f207a53..f7440370 100644
--- a/Propellor/Property/OpenId.hs
+++ b/Propellor/Property/OpenId.hs
@@ -4,14 +4,21 @@ import Propellor
import qualified Propellor.Property.File as File
import qualified Propellor.Property.Apt as Apt
-providerFor :: [UserName] -> Property
-providerFor users = propertyList ("openid provider") $
+import Data.List
+
+providerFor :: [UserName] -> HostName -> Property
+providerFor users hostname = propertyList ("openid provider") $
[ serviceRunning "apache2"
`requires` Apt.installed ["apache2"]
, Apt.installed ["simpleid"]
`onChange` serviceRestarted "apache2"
- , serviceRestarted "apache2"
+ , File.fileProperty ("simpleid host " ++ hostname)
+ (map setbaseurl) "/etc/simpleid/config.inc"
] ++ map identfile users
where
identfile u = File.hasPrivContent $ concat
[ "/var/lib/simpleid/identities/", u, ".identity" ]
+ setbaseurl l
+ | "SIMPLEID_BASE_URL" `isInfixOf` l =
+ "define('SIMPLEID_BASE_URL', 'http://"++hostname++"/simpleid');"
+ | otherwise = l