forked from revel/revel
/
run.go
41 lines (35 loc) · 968 Bytes
/
run.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package main
import (
"github.com/robfig/revel"
"github.com/robfig/revel/harness"
"log"
)
var cmdRun = &Command{
UsageLine: "run [import path] [run mode]",
Short: "run a Revel application",
Long: `~
~ Run the Revel web application named by the given import path.
~
~ For example, to run the chat room sample application:
~
~ rev run github.com/robfig/revel/samples/chat
~
~ The run mode is used to select which set of app.conf configuration should
~ apply and may be used to determine logic in the application itself.
~
~ Run mode defaults to "dev". To run in production mode, specify "prod"`,
}
func init() {
cmdRun.Run = runApp
}
func runApp(args []string) {
// TODO: Why can't it be any arbitrary string again?
mode := rev.DEV
if len(args) == 2 && args[1] == rev.PROD {
mode = rev.PROD
}
// Find and parse app.conf
rev.Init(args[0], mode)
log.Printf("Running app (%s): %s (%s)\n", mode, rev.AppName, rev.BasePath)
harness.Run(mode)
}