Update environment variables to support custom data directory
This commit is contained in:
parent
5484699565
commit
dbe5cb2985
16
README
16
README
@ -1,16 +1,6 @@
|
|||||||
purr
|
purr
|
||||||
-----
|
-----
|
||||||
|
|
||||||
STATUS: IT JUST WERKS
|
|
||||||
|
|
||||||
DETAILS: We're on Saltine now and nix builds are working.
|
|
||||||
The documentation that was in this README for setup isn't 100% accurate
|
|
||||||
anymore, so I removed it. I'm going to add some functions to gracefully
|
|
||||||
handle the setup of the new keyfile dependency and will create new build
|
|
||||||
and development documentation in this repo then. Also, I'll start
|
|
||||||
using Markdown when I redo the docs like a sensible person. Stay tuned!
|
|
||||||
|
|
||||||
|
|
||||||
https://purr.eversole.co
|
https://purr.eversole.co
|
||||||
a work-in-progress web application offering customizable password generation
|
a work-in-progress web application offering customizable password generation
|
||||||
and time-limited sharing of secrets.
|
and time-limited sharing of secrets.
|
||||||
@ -29,13 +19,13 @@ that don't offer better authentication methods.
|
|||||||
- Share text secrets with others without disclosing the secret in the
|
- Share text secrets with others without disclosing the secret in the
|
||||||
message itself.
|
message itself.
|
||||||
|
|
||||||
- Be really cute compared to the competition.
|
|
||||||
|
|
||||||
- Provide a minimal and clean interface for generating and sharing passwords.
|
- Provide a minimal and clean interface for generating and sharing passwords.
|
||||||
|
|
||||||
- Maintain a clean and organized codebase that can be extended to include more
|
- Maintain a clean and organized codebase that can be extended to include more
|
||||||
utilities than originally anticipated.
|
utilities than originally anticipated.
|
||||||
|
|
||||||
|
- Be really cute compared to the competition.
|
||||||
|
|
||||||
WHY TRUST YOU?
|
WHY TRUST YOU?
|
||||||
|
|
||||||
You shouldn't. This is free and open-source software which you can run on your
|
You shouldn't. This is free and open-source software which you can run on your
|
||||||
@ -43,7 +33,7 @@ own hardware.
|
|||||||
|
|
||||||
DEPLOYMENT
|
DEPLOYMENT
|
||||||
|
|
||||||
Updates to this section coming soon.
|
|
||||||
|
|
||||||
DEVELOPMENT & SUPPORT
|
DEVELOPMENT & SUPPORT
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
environment="production"
|
ENVIRONMENT="production"
|
||||||
applicationHost="localhost"
|
APPLICATIONHOST="localhost"
|
||||||
applicationPort="3000"
|
APPLICATIONPORT="3000"
|
||||||
dbFile="data/Purr.sqlite"
|
DATAPATH="./"
|
||||||
linkLength="24"
|
DBFILE="data/Purr.sqlite"
|
||||||
adminEmail="admin@purr.example.com"
|
LINKLENGTH="24"
|
||||||
|
ADMINEMAIL="admin@purr.example.com"
|
||||||
|
@ -15,22 +15,31 @@ main = do
|
|||||||
|
|
||||||
keyFileInit :: IO ()
|
keyFileInit :: IO ()
|
||||||
keyFileInit = do
|
keyFileInit = do
|
||||||
keyExists <- doesFileExist "./data/encryptionKey"
|
dataPathStr <- dataPath
|
||||||
|
keyExists <- doesFileExist $ dataPathStr ++ "data/encryptionKey"
|
||||||
case keyExists of
|
case keyExists of
|
||||||
True -> putStrLn "Using existing key"
|
True -> putStrLn "Using existing key"
|
||||||
False -> do
|
False -> do
|
||||||
key <- newKey
|
key <- newKey
|
||||||
B.writeFile "./data/encryptionKey" (encode key)
|
B.writeFile (dataPathStr ++ "data/encryptionKey") (encode key)
|
||||||
putStrLn "Creating new encryption key; any pre-existing DB entries will not decrypt"
|
putStrLn "Creating new encryption key; any pre-existing DB entries will not decrypt"
|
||||||
|
|
||||||
dbPath :: IO String
|
|
||||||
dbPath = getEnv "dbFile"
|
|
||||||
|
|
||||||
confLinkLength :: IO String
|
|
||||||
confLinkLength = getEnv "linkLength"
|
|
||||||
|
|
||||||
adminEmail :: IO String
|
adminEmail :: IO String
|
||||||
adminEmail = getEnv "adminEmail"
|
adminEmail = getEnv "ADMINEMAIL"
|
||||||
|
|
||||||
appPort :: IO String
|
appPort :: IO String
|
||||||
appPort = getEnv "applicationPort"
|
appPort = getEnv "APPLICATIONPORT"
|
||||||
|
|
||||||
|
dataPath :: IO String
|
||||||
|
dataPath = getEnv "DATADIR"
|
||||||
|
|
||||||
|
dbPath :: IO String
|
||||||
|
dbPath = getEnv "DBFILE"
|
||||||
|
|
||||||
|
confLinkLength :: IO String
|
||||||
|
confLinkLength = getEnv "LINKLENGTH"
|
||||||
|
|
||||||
|
encKey :: IO B.ByteString
|
||||||
|
encKey = do
|
||||||
|
dataPathStr <- dataPath
|
||||||
|
B.readFile (dataPathStr ++ "data/encryptionKey")
|
||||||
|
@ -11,7 +11,6 @@ import Control.Monad.Trans (liftIO)
|
|||||||
import Data.Maybe (Maybe (Nothing))
|
import Data.Maybe (Maybe (Nothing))
|
||||||
import Network.Wai.Middleware.RequestLogger (logStdoutDev)
|
import Network.Wai.Middleware.RequestLogger (logStdoutDev)
|
||||||
import Network.Wai.Middleware.Static
|
import Network.Wai.Middleware.Static
|
||||||
import System.Environment
|
|
||||||
import Web.Scotty
|
import Web.Scotty
|
||||||
|
|
||||||
app :: PurrApp ()
|
app :: PurrApp ()
|
||||||
|
@ -23,6 +23,3 @@ main = do
|
|||||||
\ views INT,\
|
\ views INT,\
|
||||||
\ maxViews INT)"
|
\ maxViews INT)"
|
||||||
close conn
|
close conn
|
||||||
|
|
||||||
encKey :: IO ByteString
|
|
||||||
encKey = B.readFile "./data/encryptionKey"
|
|
||||||
|
@ -12,7 +12,6 @@ import Control.Monad.Trans (liftIO)
|
|||||||
import Data.List.Split (splitOn)
|
import Data.List.Split (splitOn)
|
||||||
import Data.Maybe (listToMaybe)
|
import Data.Maybe (listToMaybe)
|
||||||
import Prelude
|
import Prelude
|
||||||
import System.Environment
|
|
||||||
import Web.Scotty
|
import Web.Scotty
|
||||||
|
|
||||||
import qualified Data.Text as T
|
import qualified Data.Text as T
|
||||||
|
@ -13,8 +13,8 @@ import Web.Scotty
|
|||||||
main :: IO ()
|
main :: IO ()
|
||||||
main = do
|
main = do
|
||||||
sodiumInit
|
sodiumInit
|
||||||
Configuration.keyFileInit
|
|
||||||
Configuration.main
|
Configuration.main
|
||||||
|
Configuration.keyFileInit
|
||||||
DB.main
|
DB.main
|
||||||
appPortStr <- Configuration.appPort
|
appPortStr <- Configuration.appPort
|
||||||
let appPort = read appPortStr :: Int
|
let appPort = read appPortStr :: Int
|
||||||
|
Loading…
x
Reference in New Issue
Block a user