diff --git a/harness/build.go b/harness/build.go index 29383a34..660c4811 100755 --- a/harness/build.go +++ b/harness/build.go @@ -42,12 +42,22 @@ func Build(buildFlags ...string) (app *App, compileError *revel.Error) { sourceInfo.InitImportPaths = append(sourceInfo.InitImportPaths, dbImportPath) } + importPaths := calcImportAliases(sourceInfo) + + // Add the custom server import path + var customServer bool + if serverImportPath, found := revel.Config.String("module.server"); found { + importPaths[serverImportPath] = "server" + customServer = true + } + // Generate two source files. templateArgs := map[string]interface{}{ "Controllers": sourceInfo.ControllerSpecs(), "ValidationKeys": sourceInfo.ValidationKeys, - "ImportPaths": calcImportAliases(sourceInfo), + "ImportPaths": importPaths, "TestSuites": sourceInfo.TestSuites(), + "CustomServer": customServer, } genSource("tmp", "main.go", RevelMainTemplate, templateArgs) genSource("routes", "routes.go", RevelRoutesTemplate, templateArgs) @@ -418,7 +428,11 @@ func main() { (*{{index $.ImportPaths .ImportPath}}.{{.StructName}})(nil),{{end}} } + {{if .CustomServer}} + server.Run(revel.InitServer()) + {{else}} revel.Run(*port) + {{end}} } `