1

How can I programatically detect if I'm in production mode or development mode in revel framework?

icza
  • 389,944
  • 63
  • 907
  • 827
Pablo Jomer
  • 9,870
  • 11
  • 54
  • 102

1 Answers1

5

There are exported global variables in the revel package:

var (
    RunMode string // Application-defined (by default, "dev" or "prod")
    DevMode bool   // if true, RunMode is a development mode.
)

So for example:

if revel.DevMode {
    // Running in development mode
} else {
    // Production mode
}
icza
  • 389,944
  • 63
  • 907
  • 827