From e8b06b66775d3b15bb18c526eb9336f1e8804cbe Mon Sep 17 00:00:00 2001 From: mrz1836 Date: Thu, 14 Apr 2022 11:55:34 -0400 Subject: [PATCH] Debugging mods --- config/config.go | 10 ---------- config/envs/development.json | 8 -------- config/envs/docker-compose.json | 7 ------- config/envs/production.json | 9 +-------- config/envs/staging.json | 7 ------- config/envs/test.json | 7 ------- config/services.go | 12 ++---------- 7 files changed, 3 insertions(+), 57 deletions(-) diff --git a/config/config.go b/config/config.go index e65a7605b..d820f935f 100644 --- a/config/config.go +++ b/config/config.go @@ -58,7 +58,6 @@ type ( NewRelic *NewRelicConfig `json:"new_relic" mapstructure:"new_relic"` Paymail *PaymailConfig `json:"paymail" mapstructure:"paymail"` Redis *RedisConfig `json:"redis" mapstructure:"redis"` - Ristretto *RistrettoConfig `json:"ristretto" mapstructure:"ristretto"` Server *ServerConfig `json:"server" mapstructure:"server"` SQL *datastore.SQLConfig `json:"sql" mapstructure:"sql"` SQLite *datastore.SQLiteConfig `json:"sqlite" mapstructure:"sqlite"` @@ -130,15 +129,6 @@ type ( QueueName string `json:"queue_name" mapstructure:"queue_name"` // test_queue } - // RistrettoConfig is the configuration for the Ristretto cachestore - RistrettoConfig struct { - BufferItems int64 `json:"buffer_items" mapstructure:"buffer_items"` // See: ristretto.Config in cache.go - IgnoreInternalCost bool `json:"ignore_internal_cost" mapstructure:"ignore_internal_cost"` // See: ristretto.Config in cache.go - MaxCost int64 `json:"max_cost" mapstructure:"max_cost"` // See: ristretto.Config in cache.go - Metrics bool `json:"metrics" mapstructure:"metrics"` // See: ristretto.Config in cache.go - NumCounters int64 `json:"num_counters" mapstructure:"num_counters"` // See: ristretto.Config in cache.go - } - // ServerConfig is a configuration for the HTTP Server ServerConfig struct { IdleTimeout time.Duration `json:"idle_timeout" mapstructure:"idle_timeout"` // 60s diff --git a/config/envs/development.json b/config/envs/development.json index 6c4c01b18..bfce0bfe7 100644 --- a/config/envs/development.json +++ b/config/envs/development.json @@ -26,7 +26,6 @@ "playground_path": "/graphiql" }, "mongodb": { - "debug": true, "database_name": "xapi", "transactions": false, "uri": "mongodb://localhost:27017/xapi" @@ -56,13 +55,6 @@ "url": "redis://localhost:6379", "use_tls": false }, - "ristretto": { - "buffer_items": 64, - "ignore_internal_cost": false, - "max_cost": 1073741824, - "metrics": false, - "num_counters": 1e7 - }, "server": { "idle_timeout": "60s", "port": "3003", diff --git a/config/envs/docker-compose.json b/config/envs/docker-compose.json index 51cddb0ee..89d199920 100644 --- a/config/envs/docker-compose.json +++ b/config/envs/docker-compose.json @@ -55,13 +55,6 @@ "url": "redis://redis:6379", "use_tls": false }, - "ristretto": { - "buffer_items": 64, - "ignore_internal_cost": false, - "max_cost": 1073741824, - "metrics": false, - "num_counters": 1e7 - }, "server": { "idle_timeout": "60s", "port": "3003", diff --git a/config/envs/production.json b/config/envs/production.json index 1fa390b72..75c9aa924 100644 --- a/config/envs/production.json +++ b/config/envs/production.json @@ -16,7 +16,7 @@ "datastore": { "auto_migrate": false, "engine": "sqlite", - "debug": true, + "debug": false, "table_prefix": "bux" }, "graphql": { @@ -56,13 +56,6 @@ "url": "redis://buxcache.production.tonicpow.com:6379", "use_tls": false }, - "ristretto": { - "buffer_items": 64, - "ignore_internal_cost": false, - "max_cost": 1073741824, - "metrics": false, - "num_counters": 1e7 - }, "server": { "idle_timeout": "60s", "port": "3003", diff --git a/config/envs/staging.json b/config/envs/staging.json index a90cc2f7d..34c69dd32 100644 --- a/config/envs/staging.json +++ b/config/envs/staging.json @@ -56,13 +56,6 @@ "url": "redis://buxcache.staging.tonicpow.com:6379", "use_tls": false }, - "ristretto": { - "buffer_items": 64, - "ignore_internal_cost": false, - "max_cost": 1073741824, - "metrics": false, - "num_counters": 1e7 - }, "server": { "idle_timeout": "60s", "port": "3003", diff --git a/config/envs/test.json b/config/envs/test.json index 14a5fcb7a..ebaed2d26 100644 --- a/config/envs/test.json +++ b/config/envs/test.json @@ -55,13 +55,6 @@ "url": "redis://localhost:6379", "use_tls": false }, - "ristretto": { - "buffer_items": 64, - "ignore_internal_cost": false, - "max_cost": 1073741824, - "metrics": false, - "num_counters": 1e7 - }, "server": { "idle_timeout": "60s", "port": "3003", diff --git a/config/services.go b/config/services.go index 681dcd0c4..d2ee128f9 100644 --- a/config/services.go +++ b/config/services.go @@ -138,6 +138,8 @@ func (s *AppServices) loadBux(ctx context.Context, appConfig *AppConfig) (err er options = append(options, bux.WithITCDisabled()) } + // todo: customize the logger + // todo: feature: override the config from JSON env (side-load your own /envs/custom-config.json // Debugging @@ -261,9 +263,6 @@ func loadDatastore(options []bux.ClientOps, appConfig *AppConfig) ([]bux.ClientO // Select the datastore if appConfig.Datastore.Engine == datastore.SQLite { debug := appConfig.Datastore.Debug - if appConfig.SQLite.Debug { - debug = appConfig.SQLite.Debug - } tablePrefix := appConfig.Datastore.TablePrefix if len(appConfig.SQLite.TablePrefix) > 0 { tablePrefix = appConfig.SQLite.TablePrefix @@ -277,11 +276,7 @@ func loadDatastore(options []bux.ClientOps, appConfig *AppConfig) ([]bux.ClientO Shared: appConfig.SQLite.Shared, })) } else if appConfig.Datastore.Engine == datastore.MySQL || appConfig.Datastore.Engine == datastore.PostgreSQL { - debug := appConfig.Datastore.Debug - if appConfig.SQL.Debug { - debug = appConfig.SQL.Debug - } tablePrefix := appConfig.Datastore.TablePrefix if len(appConfig.SQL.TablePrefix) > 0 { tablePrefix = appConfig.SQL.TablePrefix @@ -309,9 +304,6 @@ func loadDatastore(options []bux.ClientOps, appConfig *AppConfig) ([]bux.ClientO } else if appConfig.Datastore.Engine == datastore.MongoDB { debug := appConfig.Datastore.Debug - if appConfig.Mongo.Debug { - debug = appConfig.Mongo.Debug - } tablePrefix := appConfig.Datastore.TablePrefix if len(appConfig.Mongo.TablePrefix) > 0 { tablePrefix = appConfig.Mongo.TablePrefix