diff --git a/db/db.go b/db/db.go index d7e25f4e..1ca06068 100644 --- a/db/db.go +++ b/db/db.go @@ -16,6 +16,7 @@ package db import ( "io" + "os" "context" @@ -160,6 +161,12 @@ func Process(fib *fibre.Context, ast *sql.Query, vars map[string]interface{}) (o vars[varKeyOrigin] = fib.Origin() + // Ensure that the specified environment + // variable 'ENV' is available to the + // request, to detect the environment. + + vars[varKeyEnv] = os.Getenv(varKeyEnv) + // Ensure that the current authentication // data is made available as a runtime // variable to the query layer. diff --git a/db/vars.go b/db/vars.go index 03fbdc70..a9b90283 100644 --- a/db/vars.go +++ b/db/vars.go @@ -60,6 +60,7 @@ const ( const ( varKeyId = "id" varKeyIp = "ip" + varKeyEnv = "ENV" varKeyAuth = "auth" varKeyKeep = "keep" varKeyThis = "this"