Skip to content

Commit

Permalink
Use specific setting for auth dummy
Browse files Browse the repository at this point in the history
  • Loading branch information
amitaibu committed Sep 7, 2016
1 parent 5fb1861 commit b61f958
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Foundation.hs
Expand Up @@ -153,8 +153,8 @@ instance YesodAuth App where

-- You can add other plugins like Google Email, email or OAuth here
authPlugins app = [authOpenId Claimed []] ++ extraAuthPlugins
-- Enable authDummy login when in development mode.
where extraAuthPlugins = [authDummy | appDevelopment $ appSettings app]
-- Enable authDummy login if enabled.
where extraAuthPlugins = [authDummy | appAuthDummyLogin $ appSettings app]



Expand Down
9 changes: 5 additions & 4 deletions Settings.hs
Expand Up @@ -55,8 +55,8 @@ data AppSettings = AppSettings
, appAnalytics :: Maybe Text
-- ^ Google Analytics code

, appDevelopment :: Bool
-- ^ Indicate if we are in development mode
, appAuthDummyLogin :: Bool
-- ^ Indicate if auth dummy login should be enabled.
}

instance FromJSON AppSettings where
Expand All @@ -80,10 +80,11 @@ instance FromJSON AppSettings where
appMutableStatic <- o .:? "mutable-static" .!= defaultDev
appSkipCombining <- o .:? "skip-combining" .!= defaultDev

appCopyright <- o .: "copyright"
appCopyright <- o .: "copyright"
appAnalytics <- o .:? "analytics"

appDevelopment <- o .:? "development" .!= defaultDev
appAuthDummyLogin <- o .:? "auth-dummy-login" .!= defaultDev

return AppSettings {..}

-- | Settings for 'widgetFile', such as which template languages to support and
Expand Down
2 changes: 1 addition & 1 deletion config/settings.yml
Expand Up @@ -13,12 +13,12 @@ ip-from-header: "_env:IP_FROM_HEADER:false"
# Optional values with the following production defaults.
# In development, they default to the inverse.
#
# development: false
# detailed-logging: false
# should-log-all: false
# reload-templates: false
# mutable-static: false
# skip-combining: false
# auth-dummy-login : false

# NB: If you need a numeric value (e.g. 123) to parse as a String, wrap it in single quotes (e.g. "_env:PGPASS:'123'")
# See https://github.com/yesodweb/yesod/wiki/Configuration#parsing-numeric-values-as-strings
Expand Down

0 comments on commit b61f958

Please sign in to comment.