Enable global ENV variable to detect environment

This commit is contained in:
Tobie Morgan Hitchcock 2018-05-09 04:08:04 +01:00
parent ebd5680b7d
commit 5442861cb8
2 changed files with 8 additions and 0 deletions

View file

@ -16,6 +16,7 @@ package db
import ( import (
"io" "io"
"os"
"context" "context"
@ -160,6 +161,12 @@ func Process(fib *fibre.Context, ast *sql.Query, vars map[string]interface{}) (o
vars[varKeyOrigin] = fib.Origin() 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 // Ensure that the current authentication
// data is made available as a runtime // data is made available as a runtime
// variable to the query layer. // variable to the query layer.

View file

@ -60,6 +60,7 @@ const (
const ( const (
varKeyId = "id" varKeyId = "id"
varKeyIp = "ip" varKeyIp = "ip"
varKeyEnv = "ENV"
varKeyAuth = "auth" varKeyAuth = "auth"
varKeyKeep = "keep" varKeyKeep = "keep"
varKeyThis = "this" varKeyThis = "this"