Skip to content

Commit

Permalink
Debugging mods
Browse files Browse the repository at this point in the history
  • Loading branch information
mrz1836 committed Apr 14, 2022
1 parent 33116d6 commit e8b06b6
Show file tree
Hide file tree
Showing 7 changed files with 3 additions and 57 deletions.
10 changes: 0 additions & 10 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down Expand Up @@ -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
Expand Down
8 changes: 0 additions & 8 deletions config/envs/development.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
"playground_path": "/graphiql"
},
"mongodb": {
"debug": true,
"database_name": "xapi",
"transactions": false,
"uri": "mongodb://localhost:27017/xapi"
Expand Down Expand Up @@ -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",
Expand Down
7 changes: 0 additions & 7 deletions config/envs/docker-compose.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
9 changes: 1 addition & 8 deletions config/envs/production.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"datastore": {
"auto_migrate": false,
"engine": "sqlite",
"debug": true,
"debug": false,
"table_prefix": "bux"
},
"graphql": {
Expand Down Expand Up @@ -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",
Expand Down
7 changes: 0 additions & 7 deletions config/envs/staging.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
7 changes: 0 additions & 7 deletions config/envs/test.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
12 changes: 2 additions & 10 deletions config/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit e8b06b6

Please sign in to comment.