package application import "git.ali33.ru/fcg-xvii/rest" func HTTPHeadersCrossOrigin() func() map[string]string { return func() map[string]string { return map[string]string{ "Access-Control-Allow-Origin": "*", "Access-Control-Allow-Methods": "POST, GET, OPTIONS, PUT, DELETE", "Access-Control-Allow-Headers": "Content-Type, Authorization, X-Requested-With", } } } type AppConfig struct { SSL bool Addr string Http bool Websocket bool Secret []byte HttpPrefix string WebsocketPrefix string HTTPHeaders func() map[string]string Commands func(string) (rest.IExecuter, bool) TLSKeyPath string TLSCertPath string Core any OnSocketConnect func(rest.IStream) OnSocketDisconnect func(rest.IStream) } func (s *AppConfig) GetHttpPrefix() string { if len(s.HttpPrefix) > 0 { return s.HttpPrefix } return "/api/" } func (s *AppConfig) GetWebsocketPrefix() string { if len(s.WebsocketPrefix) > 0 { return s.WebsocketPrefix } return "/ws/" } func (s *AppConfig) GetHTTPHeaders() func() map[string]string { if s.HTTPHeaders != nil { return s.HTTPHeaders } return func() map[string]string { return map[string]string{} } }