dillonkearns/elm-pages-v3-beta/8.0.0

NOTE: the latest version is 21.0.0

Rerouted (regenerated, verified). Same repository and tag, but GitHub now builds the zip with different bytes, so it no longer matches the SHA-1 package.elm-lang.org recorded. The Lamdera package server serves a copy recovered from https://github.com/dillonkearns/elm-pages-v3-beta.

What we checked: Tag 8.0.0 is still on github.com/dillonkearns/elm-pages-v3-beta; its commit b7735572454e is from 2023-01-17 05:49 UTC, before the version was published (2023-01-17 05:52 UTC); elm.json is byte-identical to package.elm-lang.org's; the exposed modules match docs.json; the zip's SHA-1 is not the published one (GitHub's zip no longer comes out byte for byte the same), so the contents were checked instead.

The Lamdera compiler uses this copy and prints a one-line notice saying so. elm itself fails to download this version.

Details · package.elm-lang.org's zip: https://github.com/dillonkearns/elm-pages-v3-beta/zipball/8.0.0/

BackendTask.Env

Because BackendTask's in elm-pages never run in the browser (see the BackendTask docs), you can access environment variables securely. As long as the environment variable isn't sent down into the final Data value, it won't end up in the client!

import BackendTask exposing (BackendTask)
import BackendTask.Env
import FatalError exposing (FatalError)


type alias EnvVariables =
    { sendGridKey : String
    , siteUrl : String
    }


sendEmail : Email -> BackendTask FatalError ()
sendEmail email =
    BackendTask.map2 EnvVariables
        (BackendTask.Env.expect "SEND_GRID_KEY" |> BackendTask.allowFatal)
        (BackendTask.Env.get "BASE_URL"
            |> BackendTask.map (Maybe.withDefault "http://localhost:1234")
        )
        |> BackendTask.andThen (sendEmailBackendTask email)


sendEmailBackendTask : Email -> EnvVariables -> BackendTask FatalError ()
sendEmailBackendTask email envVariables =
    Debug.todo "Not defined here"
get : String -> BackendTask error (Maybe String)

Get an environment variable, or Nothing if there is no environment variable matching that name. This BackendTask will never fail, but instead will return Nothing if the environment variable is missing.

String
-> BackendTask
{ fatal : FatalError
, recoverable : Error
}
String

Get an environment variable, or a BackendTask FatalError if there is no environment variable matching that name.

Errors

type Error
= MissingEnvVariable String