only rewrite routes if LOCALHOST env variable is unset
This commit is contained in:
parent
6bb3dbaef7
commit
b8e947fea4
@ -39,6 +39,8 @@ import Data.Void
|
||||
|
||||
import Network.URI
|
||||
|
||||
import System.Environment (lookupEnv)
|
||||
|
||||
config :: Configuration
|
||||
config =
|
||||
defaultConfiguration
|
||||
@ -65,7 +67,8 @@ unwrapped :: Snapshot
|
||||
unwrapped = "unwrapped"
|
||||
|
||||
main :: IO ()
|
||||
main = hakyllWith config $ do
|
||||
main =
|
||||
lookupEnv "LOCALHOST" >>= \((Nothing /=) -> localhost) -> hakyllWith config $ do
|
||||
frontendManifest <-
|
||||
preprocess $
|
||||
Yaml.decodeFileThrow @_ @(Map String [FilePath]) "frontend/dist/.manifest.yaml"
|
||||
@ -88,6 +91,9 @@ main = hakyllWith config $ do
|
||||
forM resources $ load . fromFilePath . ("frontend/dist" </>) . dropDrive
|
||||
|
||||
netlifyRedirects <-
|
||||
if localhost
|
||||
then return []
|
||||
else
|
||||
preprocess . handleIf isDoesNotExistError (const $ return []) $
|
||||
let pNetlify :: ParsecT Void Lazy.Text m [(FilePath, FilePath)]
|
||||
pNetlify = catMaybes <$> MP.sepBy (MP.space *> pLine <* MP.hspace) pEOL <* MP.eof
|
||||
|
||||
Loading…
Reference in New Issue
Block a user