Revel

Constants

const (
    REVEL_IMPORT_PATH = "github.com/robfig/revel"
)

Variables

var (
    // App details
    AppName    string // e.g. "sample"
    BasePath   string // e.g. "/Users/robfig/gocode/src/corp/sample"
    AppPath    string // e.g. "/Users/robfig/gocode/src/corp/sample/app"
    ViewsPath  string // e.g. "/Users/robfig/gocode/src/corp/sample/app/views"
    ImportPath string // e.g. "corp/sample"
    SourcePath string // e.g. "/Users/robfig/gocode/src"

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

    // Revel installation details
    RevelPath string // e.g. "/Users/robfig/gocode/src/revel"

    // Where to look for templates and configuration.
    // Ordered by priority.  (Earlier paths take precedence over later paths.)
    CodePaths     []string
    ConfPaths     []string
    TemplatePaths []string

    Modules []Module

    // Server config.
    //
    // Alert: This is how the app is configured, which may be different from
    // the current process reality.  For example, if the app is configured for
    // port 9000, HttpPort will always be 9000, even though in dev mode it is
    // run on a random port and proxied.
    HttpPort    int    // e.g. 9000
    HttpAddr    string // e.g. "", "127.0.0.1"
    HttpSsl     bool   // e.g. true if using ssl
    HttpSslCert string // e.g. "/path/to/cert.pem"
    HttpSslKey  string // e.g. "/path/to/key.pem"

    // All cookies dropped by the framework begin with this prefix.
    CookiePrefix string

    // Cookie flags
    CookieHttpOnly bool
    CookieSecure   bool

    // Delimiters to use when rendering templates
    TemplateDelims string

    // Loggers
    TRACE = log.New(ioutil.Discard, "TRACE ", log.Ldate|log.Ltime|log.Lshortfile)
    INFO  = log.New(ioutil.Discard, "INFO  ", log.Ldate|log.Ltime|log.Lshortfile)
    WARN  = log.New(ioutil.Discard, "WARN  ", log.Ldate|log.Ltime|log.Lshortfile)
    ERROR = log.New(&error_log, "ERROR ", log.Ldate|log.Ltime|log.Lshortfile)

    Initialized bool
)

func CheckInit

func CheckInit()

func Init

func Init(mode, importPath, srcPath string)

Init initializes Revel -- it provides paths for getting around the app.

Params:

mode - the run mode, which determines which app.conf settings are used.
importPath - the Go import path of the application.
srcPath - the path to the source directory, containing Revel and the app.
  If not specified (""), then a functioning Go installation is required.

func ResolveImportPath

func ResolveImportPath(importPath string) (string, error)

ResolveImportPath returns the filesystem path for the given import path. Returns an error if the import path could not be found.

type Module

type Module struct {
    Name, ImportPath, Path string
}

func ModuleByName

func ModuleByName(name string) (m Module, found bool)

ModuleByName returns the module of the given name, if loaded.