-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
some more settings and env vars, updated contact page
- Loading branch information
1 parent
19d931e
commit 30ee0e7
Showing
10 changed files
with
82 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
{-# LANGUAGE OverloadedStrings #-} | ||
|
||
module Helpers.Settings where | ||
|
||
import System.Environment (lookupEnv, getArgs) | ||
import Data.List (find) | ||
import Data.Text (isInfixOf, pack, unpack) | ||
import Data.List.Split (splitOn) | ||
|
||
argOrEnvOrDefault :: String -> String -> String -> IO String | ||
argOrEnvOrDefault arg env def = do | ||
args <- getArgs | ||
case find (isInfixOf (pack arg)) [pack arg | arg <- args] of | ||
(Just x) -> return $ splitOn "=" (unpack x) !! 1 | ||
_ -> do | ||
var <- lookupEnv env | ||
return $ case var of | ||
(Just a) -> a | ||
_ -> def | ||
|
||
argOrEnvOrBool :: String -> String -> IO Bool | ||
argOrEnvOrBool arg env = do | ||
args <- getArgs | ||
case find (== arg) args of | ||
(Just _) -> return True | ||
_ -> do | ||
var <- lookupEnv env | ||
return $ case var of | ||
(Just "1") -> True | ||
_ -> False | ||
|
||
|
||
getDbPath :: IO String | ||
getDbPath = argOrEnvOrDefault "--db" "HOMEPAGE_DB" "./homrpage.db3" | ||
|
||
getPort :: IO Int | ||
getPort = do | ||
var <- argOrEnvOrDefault "--port" "HOMEPAGE_PORT" "8000" | ||
return $ read var | ||
|
||
data LogLevel = Error | Warning | Info | ||
|
||
getLogLevel :: IO LogLevel | ||
getLogLevel = do | ||
var <- argOrEnvOrDefault "--loglevel" "HOMEPAGE_LOGLEVEL" "error" | ||
return $ case var of | ||
"info" -> Info | ||
"warning" -> Warning | ||
"error" -> Error | ||
_ -> Error | ||
|
||
getCliState :: IO Bool | ||
getCliState = argOrEnvOrBool "--cli" "HOMEPAGE_CLI" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,15 +11,26 @@ contact = [hsx| | |
Here's my various contact addresses | ||
<br> | ||
<table style="display:inline-block;border:1px solid white; padding:5px;"> | ||
{row ["Type", "Address"]} | ||
{row ["Email", "[email protected]"]} | ||
{row ["University Email", "[email protected]"]} | ||
{row ["Matrix", "@mast3r:skade.dev"]} | ||
{row ["Discord", "mast3r_waf1z"]} | ||
{mconcat rows} | ||
</table> | ||
|
||
<h2>Socials</h2> | ||
Links to my socials | ||
<br> | ||
{linkImage "LinkedIn" "/static/contact/LinkedIn.png" "https://www.linkedin.com/in/thomas-m%C3%B8ller-j-a76601a6/"} | ||
|
||
<h2>University</h2> | ||
|
||
<div style="border:1px solid white; border-radius: 10px; margin: 0% 30% 0% 30%"> | ||
<img src="/static/contact/fspinner.gif" style="width:150px; height:150px;"> | ||
<p>Where to find me: <br><a href="https://fklub.dk/jaegerstuen">Jægerstuen</a> - Selma Lagerløfs Vej 300, 9220 Aalborg Øst</p><br> | ||
</div><br> | ||
|] | ||
where | ||
rows = [ | ||
row [[hsx|Type|], [hsx|Address|]], | ||
row [[hsx|Email|], [hsx|<a href="mailto://[email protected]">[email protected]</a>|]], | ||
row [[hsx|University Email|], [hsx|<a href="mailto://[email protected]">[email protected]</a>|]], | ||
row [[hsx|Matrix|], [hsx|@mast3r:skade.dev|]], | ||
row [[hsx|Discord|], [hsx|mast3r_waf1z|]] | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.