Configs/
directory of your app.
Application.boot()
function which runs after all Services & Plugins have loaded.
var configuration: Configuration
.
HTTP/1.1
. You can enable running over TLS with useHTTPS(...)
.
HTTP/2
with useHTTP2(...)
.
HTTP/2
is only supported over TLS and so automatically uses it. You don’t need to call both useHTTPS
and useHTTP2
.Environment
type, easily accessed through the Env
alias. By default when your app boots it will load all process environment variables as well as an optional dotenv file.
local
, stage
, and prod
.
The default dotenv file at .env
includes some common environment variables. Inside your .env
file, keys & values are separated with an =
.
local
and loads variables from any file at .env
. To change this, run your app with the -e {env_name}
flag or set APP_ENV={env_name}
in the process environment. This will set the environment name to {env_name}
and load variables from a dotenv file at .env.{env_name}
.
You’ll typically have a separate dotenv file for each of your app environments (i.e. local, staging, production).
Env
alias to access the current Environment
. You can use .get(...)
, subscripts, or @dynamicMemberLookup. You’ll have to specify the type that you’d like to convert the result to and the result is always optional.
local
to test
and dotenv variables are loaded from .env.test
if it exists. You should set environment variables appropriate for testing there.
Env.isTesting
.