Display instance host at the top of all pages

This commit is contained in:
fr33domlover 2019-03-04 09:06:23 +00:00
parent ad034dbacc
commit c41f1183e0
5 changed files with 14 additions and 0 deletions

View file

@ -24,6 +24,8 @@ ip-from-header: "_env:IP_FROM_HEADER:false"
# Uncomment to set an explicit approot # Uncomment to set an explicit approot
#approot: "_env:APPROOT:http://localhost:3000" #approot: "_env:APPROOT:http://localhost:3000"
instance-host: "_env:INSTANCE_HOST:localhost"
# Encryption key file for encrypting the session cookie sent to clients # Encryption key file for encrypting the session cookie sent to clients
client-session-key: config/client_session_key.aes client-session-key: config/client_session_key.aes

View file

@ -174,6 +174,7 @@ instance Yesod App where
pc <- widgetToPageContent $ do pc <- widgetToPageContent $ do
setTitle $ toHtml $ setTitle $ toHtml $
T.intercalate "" (map snd bcs) <> "" <> title T.intercalate "" (map snd bcs) <> "" <> title
let instanceHost = appInstanceHost $ appSettings master
$(widgetFile "default-layout") $(widgetFile "default-layout")
withUrlRenderer $(hamletFile "templates/default-layout-wrapper.hamlet") withUrlRenderer $(hamletFile "templates/default-layout-wrapper.hamlet")

View file

@ -59,6 +59,9 @@ data AppSettings = AppSettings
-- | Base for all generated URLs. If @Nothing@, determined from the -- | Base for all generated URLs. If @Nothing@, determined from the
-- request headers. -- request headers.
, appRoot :: Maybe Text , appRoot :: Maybe Text
-- | The instance's host (e.g. \"dev.angeley.es\"), currently used just
-- for display.
, appInstanceHost :: Text
-- | Host/interface the server should bind to. -- | Host/interface the server should bind to.
, appHost :: HostPreference , appHost :: HostPreference
-- | Port to listen on -- | Port to listen on
@ -143,6 +146,7 @@ instance FromJSON AppSettings where
appMaxInstanceKeys <- o .:? "max-instance-keys" appMaxInstanceKeys <- o .:? "max-instance-keys"
appMaxActorKeys <- o .:? "max-actor-keys" appMaxActorKeys <- o .:? "max-actor-keys"
appRoot <- o .:? "approot" appRoot <- o .:? "approot"
appInstanceHost <- o .: "instance-host"
appHost <- fromString <$> o .: "host" appHost <- fromString <$> o .: "host"
appPort <- o .: "http-port" appPort <- o .: "http-port"
appIpFromHeader <- o .: "ip-from-header" appIpFromHeader <- o .: "ip-from-header"

View file

@ -57,3 +57,7 @@ input[type="submit"]
padding: 0.618em padding: 0.618em
border: none border: none
border-radius: 0.618em border-radius: 0.618em
.instance
color: #{light blue}
font: 180% monospace

View file

@ -33,6 +33,9 @@ $nothing
UPDATE: Federation is coming! UPDATE: Federation is coming!
<a href=@{OutboxR}>Very early testing <a href=@{OutboxR}>Very early testing
<.instance>
Vervis @ #{instanceHost}
^{breadcrumbsW} ^{breadcrumbsW}
$maybe msg <- mmsg $maybe msg <- mmsg