mirror of
https://gitee.com/dromara/mayfly-go
synced 2025-11-04 00:10:25 +08:00
26 lines
556 B
Go
26 lines
556 B
Go
|
|
package config
|
||
|
|
|
||
|
|
import "fmt"
|
||
|
|
|
||
|
|
type Server struct {
|
||
|
|
Port int `yaml:"port"`
|
||
|
|
Model string `yaml:"model"`
|
||
|
|
Cors bool `yaml:"cors"`
|
||
|
|
Static *[]*Static `yaml:"static"`
|
||
|
|
StaticFile *[]*StaticFile `yaml:"static-file"`
|
||
|
|
}
|
||
|
|
|
||
|
|
func (s *Server) GetPort() string {
|
||
|
|
return fmt.Sprintf(":%d", s.Port)
|
||
|
|
}
|
||
|
|
|
||
|
|
type Static struct {
|
||
|
|
RelativePath string `yaml:"relative-path"`
|
||
|
|
Root string `yaml:"root"`
|
||
|
|
}
|
||
|
|
|
||
|
|
type StaticFile struct {
|
||
|
|
RelativePath string `yaml:"relative-path"`
|
||
|
|
Filepath string `yaml:"filepath"`
|
||
|
|
}
|