Other
The Gin object
In your application, Gin exposes some attributes you might need. After you've required it:
local Gin = require 'gin.core.gin'
Gin.env: returns the current environment (development,test,production, or any other environment you may be running Gin in)Gin.version: returns the current Gin versionGin.settings: returns the global settings defined per environment in./config/settings.lua(see Application files, undersettings.lua)
JSON
If you need to manually encode/decode JSON, you can easily do so by first requiring cjson:
local json = require 'cjson'
- to encode:
json.encode(table) - to decode:
json.decode(string)
json exposes the CJSON class.
Running in environments
To run Gin in an environment different than development (the default), ensure this environment has been defined where appropriate (at least in ./config/settings.lua) and run:
$ GIN_ENV={environment} gin start
For instance, to run Gin in production:
$ GIN_ENV=production gin start
To stop:
$ GIN_ENV={environment} gin stop