Skip to content

Commit

Permalink
Merge pull request #25 from RTradeLtd/api/cors
Browse files Browse the repository at this point in the history
Allow CORS Configuration Via Config
  • Loading branch information
postables authored Mar 9, 2019
2 parents 4140b3d + 1b249a5 commit b0ee70d
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
3 changes: 3 additions & 0 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,7 @@ func (t *TemporalConfig) setDefaults() {
if t.LogDir == "" {
t.LogDir = "/var/log/temporal/"
}
if len(t.API.Connection.CORS.AllowedOrigin) == 0 {
t.API.Connection.CORS.AllowedOrigin = []string{"temporal.cloud", "backup.temporal.cloud"}
}
}
27 changes: 26 additions & 1 deletion config.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
"ip": "",
"port": ""
},
"cords": {
"allowed_origins": [
"temporal.cloud",
"backup.temporal.cloud"
]
},
"limit": ""
},
"jwt": {
Expand Down Expand Up @@ -40,7 +46,16 @@
"cert_path": "",
"key_file": ""
},
"auth_key": ""
"auth_key": "",
"options": {
"engine": {
"store_path": "",
"queue": {
"rate": 0,
"batch": 0
}
}
}
},
"nexus": {
"host": "",
Expand Down Expand Up @@ -73,6 +88,16 @@
"auth_key": "",
"log_file": "",
"keystore_password": ""
},
"krab_fallback": {
"url": "",
"TLS": {
"cert_path": "",
"key_file": ""
},
"auth_key": "",
"log_file": "",
"keystore_password": ""
}
},
"ethereum": {
Expand Down
3 changes: 3 additions & 0 deletions types.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ type API struct {
IP string `json:"ip"`
Port string `json:"port"`
} `json:"prometheus"`
CORS struct {
AllowedOrigin []string `json:"allowed_origins"`
} `json:"cords"`
// define the maximum number of people allowed to connect to the API
Limit string `json:"limit"`
} `json:"connection"`
Expand Down

0 comments on commit b0ee70d

Please sign in to comment.