mirror of
https://github.com/kevin-DL/revel-cmd.git
synced 2026-01-22 15:05:26 +00:00
Merge pull request #68 from Fyb3roptik/develop
Added some example code to show that DevMode and RunMode only work fr…
This commit is contained in:
@@ -28,7 +28,9 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// register startup functions with OnAppStart
|
// register startup functions with OnAppStart
|
||||||
|
// revel.DevMode and revel.RunMode only work inside of OnAppStart. See Example Startup Script
|
||||||
// ( order dependent )
|
// ( order dependent )
|
||||||
|
// revel.OnAppStart(ExampleStartupScript)
|
||||||
// revel.OnAppStart(InitDB)
|
// revel.OnAppStart(InitDB)
|
||||||
// revel.OnAppStart(FillCache)
|
// revel.OnAppStart(FillCache)
|
||||||
}
|
}
|
||||||
@@ -44,3 +46,11 @@ var HeaderFilter = func(c *revel.Controller, fc []revel.Filter) {
|
|||||||
|
|
||||||
fc[0](c, fc[1:]) // Execute the next filter stage.
|
fc[0](c, fc[1:]) // Execute the next filter stage.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func ExampleStartupScript() {
|
||||||
|
// revel.DevMod and revel.RunMode work here
|
||||||
|
// Use this script to check for dev mode and set dev/prod startup scripts here!
|
||||||
|
if revel.DevMode == true {
|
||||||
|
os.Setenv("SOME_ENV_VAR", "VALUE")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user