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

@ -6,6 +6,7 @@ type App struct {
IP string `ini:"IP"` IP string `ini:"IP"`
Logdir string Logdir string
Logfile bool Logfile bool
AllowedOrigins []string //API conf only
} }
//Database : Struct for SQL Database configuration in the config.ini file //Database : Struct for SQL Database configuration in the config.ini file
@ -29,8 +30,8 @@ type Redis struct {
//DNS : Struct for XFR and NS //DNS : Struct for XFR and NS
type DNS struct { type DNS struct {
XfrIPs []string XfrIPs []string //DNS conf only
Nameservers []string Nameservers []string //API conf only
} }
//Conf : Struct for the whole config.ini file when it will be parsed by go-ini //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"` AppMode string `ini:"app_mode"`
App App
Database Database
Redis Redis //DNS conf only
DNS DNS DNS DNS
} }