From e435d97927d37fbea032b83e791dd77dcbd47307 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 8 Apr 2014 17:29:56 -0400 Subject: propellor spin --- Propellor/Property/OpenId.hs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'Propellor') 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 -- cgit v1.2.3