From dd57a3523289887ad18350815cb50cc0e4362fce Mon Sep 17 00:00:00 2001 From: 1nv8rZim Date: Thu, 21 Sep 2023 20:58:40 -0400 Subject: [PATCH] ServiceName and Environment now controlled by config --- config/main.go | 8 ++++++++ config_example.yml | 4 +++- main.go | 5 +++-- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/config/main.go b/config/main.go index fbfba05..dee5c4f 100644 --- a/config/main.go +++ b/config/main.go @@ -27,6 +27,12 @@ var ( // MailGun is the mailgun configuration MailGun structs.MailGunConfig + + // ServiceName is the name of the application + ServiceName string + + // Environment is the environment the application is running in + Environment string ) func init() { @@ -55,6 +61,8 @@ func UpdateConfigs() { Token = viper.GetString("token") AppID = viper.GetString("app_id") GuildID = viper.GetString("guild_id") + ServiceName = viper.GetString("name") + Environment = viper.GetString("env") Logging = logging() Google = google() Web = web() diff --git a/config_example.yml b/config_example.yml index 1e19ac5..cac35de 100644 --- a/config_example.yml +++ b/config_example.yml @@ -1,5 +1,8 @@ +name: +env: app_id: guild_id: +token: logging: level: Debug # DebugLow < Debug < Info < Warning < Error < Critical < Audit audit_channel: @@ -20,7 +23,6 @@ google: web: hostname: port: -token: commands: angry_react: emoji_id: diff --git a/main.go b/main.go index 0a9e244..42f4b53 100644 --- a/main.go +++ b/main.go @@ -9,6 +9,7 @@ import ( "gitlab.ritsec.cloud/1nv8rZim/ops-bot-iii/bot" "gitlab.ritsec.cloud/1nv8rZim/ops-bot-iii/commands" + "gitlab.ritsec.cloud/1nv8rZim/ops-bot-iii/config" "gitlab.ritsec.cloud/1nv8rZim/ops-bot-iii/logging" "gitlab.ritsec.cloud/1nv8rZim/ops-bot-iii/web" ) @@ -19,8 +20,8 @@ func main() { // start datadog tracer tracer.Start( - tracer.WithService("OBIII"), - tracer.WithEnv("prod"), + tracer.WithService(config.ServiceName), + tracer.WithEnv(config.Environment), ) defer tracer.Stop()