From 8744a7e5df7222c56f8a461117ad95d0caa50ca0 Mon Sep 17 00:00:00 2001 From: Mael GRAMAIN Date: Sun, 17 Jan 2021 18:12:29 -0400 Subject: [PATCH] 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. --- utils/structs.go | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/utils/structs.go b/utils/structs.go index 1b1f932..af7a141 100644 --- a/utils/structs.go +++ b/utils/structs.go @@ -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 }