2018-10-01 15:43:18 +00:00
|
|
|
package config
|
2018-10-01 10:29:05 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"git.xdrm.io/go/aicra/driver"
|
|
|
|
)
|
|
|
|
|
|
|
|
type builder struct {
|
2018-10-01 12:02:09 +00:00
|
|
|
// Default tells whether or not to ignore the built-in components
|
|
|
|
Default bool `json:"default,ommitempty"`
|
2018-10-01 10:29:05 +00:00
|
|
|
|
|
|
|
// Folder is used to infer the 'Map' object
|
|
|
|
Folder string `json:"folder,ommitempty"`
|
|
|
|
|
|
|
|
// Map defines the association path=>file
|
2018-10-01 17:27:38 +00:00
|
|
|
Map map[string]string
|
2018-10-01 10:29:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Schema represents an AICRA configuration (not the API, the server, drivers, etc)
|
|
|
|
type Schema struct {
|
2018-10-01 17:27:38 +00:00
|
|
|
// Root is root of the project structure default is "." (current directory)
|
|
|
|
Root string `json:"root,ommitempty"`
|
2018-10-01 10:29:05 +00:00
|
|
|
|
|
|
|
// Host is the hostname to listen to (default is 0.0.0.0)
|
|
|
|
Host string `json:"host,ommitempty"`
|
|
|
|
// Port is the port to listen to (default is 80)
|
|
|
|
Port uint16 `json:"port,ommitempty"`
|
|
|
|
|
|
|
|
// DriverName is the driver used to load the controllers and middlewares
|
|
|
|
DriverName string `json:"driver"`
|
|
|
|
Driver driver.Driver
|
|
|
|
|
|
|
|
// Types defines :
|
|
|
|
// - the type folder
|
|
|
|
// - whether to load the built-in types
|
|
|
|
//
|
|
|
|
// types are ommited if not set (no default)
|
|
|
|
Types *builder `json:"types,ommitempty"`
|
|
|
|
|
|
|
|
// Controllers defines :
|
2018-10-01 17:27:38 +00:00
|
|
|
// - the controller folder
|
2018-10-01 10:29:05 +00:00
|
|
|
//
|
|
|
|
// (default is .build/controller)
|
|
|
|
Controllers *builder `json:"controllers,ommitempty"`
|
|
|
|
|
|
|
|
// Middlewares defines :
|
2018-10-01 17:27:38 +00:00
|
|
|
// - the middleware folder
|
2018-10-01 10:29:05 +00:00
|
|
|
//
|
|
|
|
// (default is .build/middleware)
|
|
|
|
Middlewares *builder `json:"middlewares,ommitempty"`
|
|
|
|
}
|