-
Notifications
You must be signed in to change notification settings - Fork 14
Env
Handles any environment info of your application. Loads any
environment variables from the file a .env
or .{APP_ENV}
if APP_ENV
is set in the current environment.
@dynamicMemberLookup public struct Env: Equatable
Variables are accessed via .get
. Supports dynamic member lookup.
// .env file:
SOME_KEY=secret_value
OTHER_KEY=123456
// Swift code
let someVariable: String? = Env.current.get("SOME_KEY")
// Dynamic member lookup
let otherVariable: Int? = Env.OTHER_KEY
Equatable
The environment file location of this application. Additional
env variables are pulled from the file at '.{name}'. This
defaults to env
or APP_ENV
if that is set.
let name: String
All environment variables available to the program.
var all: [String: String]
The current environment containing all variables loaded from the environment file.
var current: Env
Returns any environment variables loaded from the environment
file as type T: EnvAllowed
. Supports String
, Int
,
Double
, and Bool
.
public func get<S: StringInitializable>(_ key: String) -> S?
- key: The name of the environment variable.
The variable converted to type S
. nil
if the variable doesn't exist or it cannot be converted as S
.
Generated at 2021-01-13T22:24:59-0800 using swift-doc 1.0.0-beta.5.
Alchemy
Types
- AlterTableBuilder
- BCryptDigest
- BasicAuthMiddleware
- BcryptError
- BelongsToRelationship
- CORSMiddleware
- CORSMiddleware.AllowOriginSetting
- CORSMiddleware.Configuration
- ColumnType
- CreateColumn
- CreateColumnBuilder
- CreateIndex
- CreateTableBuilder
- DatabaseConfig
- DatabaseError
- DatabaseField
- DatabaseKeyMappingStrategy
- DatabaseValue
- DayUnit
- Env
- FrequencyTyped
- Grammar
- HTTPAuth
- HTTPAuth.Basic
- HTTPAuth.Bearer
- HTTPBody
- HTTPError
- HasManyRelationship
- HasOneRelationship
- HasRelationship
- HourUnit
- JoinClause
- JoinType
- Launch
- Log
- MIMEType
- MinuteUnit
- ModelQuery
- MySQLDatabase
- Operator
- OrderClause
- OrderClause.Sort
- OrderedDictionary
- PapyrusClientError
- PathParameter
- PathParameter.DecodingError
- PostgresDatabase
- Query
- Request
- Response
- Router
- RuneError
- SQL
- SQLJSON
- Scheduler
- Schema
- SecondUnit
- Services
- Socket
- StaticFileMiddleware
- StringLength
- Thread
- TokenAuthMiddleware
- WeekUnit
- Weekday
- WhereBoolean
- WhereColumn
- WhereIn
- WhereIn.InType
- WhereNested
- WhereRaw
- WhereValue