We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 78fb80c commit b03c3a6Copy full SHA for b03c3a6
config/server.go
@@ -1,9 +1,14 @@
1
package config
2
3
+type CORS struct {
4
+ AllowedOrigins []string `yaml:"allowed_origins"`
5
+}
6
+
7
/* server deployment parameters */
8
type Server struct {
9
Host string `yaml:"host,omitempty"`
10
Port int `yaml:"port,omitempty"`
11
+ Cors CORS `yaml:"cors"`
12
}
13
14
/* normalization function */
@@ -19,5 +24,10 @@ func (s *Server) Normalize() error {
19
24
s.Port = 8080
20
25
21
26
27
+ /* set default cors policy to localhost */
28
+ if len(s.Cors.AllowedOrigins) == 0 {
29
+ s.Cors.AllowedOrigins = append(s.Cors.AllowedOrigins, "http://localhost:3000")
30
+ }
31
22
32
return nil
23
33
0 commit comments