AllowedOrigins []strings option in the configuration file for the API

The App{} struct have been updated to parse a new argument for the API configuration file.

AllowedOrigins permit the user to set what URLs are allowed to send request to the API via CORS headers.
This commit is contained in:
Mael GRAMAIN 2021-01-17 18:12:29 -04:00
parent 3aa2cd4984
commit 8744a7e5df

View file

@ -2,10 +2,11 @@ package utils
//App : Struct for App (dns server) configuration in the config.ini file
type App struct {
Port int
IP string `ini:"IP"`
Logdir string
Logfile bool
Port int
IP string `ini:"IP"`
Logdir string
Logfile bool
AllowedOrigins []string //API conf only
}
//Database : Struct for SQL Database configuration in the config.ini file
@ -29,8 +30,8 @@ type Redis struct {
//DNS : Struct for XFR and NS
type DNS struct {
XfrIPs []string
Nameservers []string
XfrIPs []string //DNS conf only
Nameservers []string //API conf only
}
//Conf : Struct for the whole config.ini file when it will be parsed by go-ini
@ -38,6 +39,6 @@ type Conf struct {
AppMode string `ini:"app_mode"`
App
Database
Redis
DNS DNS
Redis //DNS conf only
DNS DNS
}