Class: QueryConsole::Configuration
- Inherits:
-
Object
- Object
- QueryConsole::Configuration
- Defined in:
- lib/query_console/configuration.rb
Instance Attribute Summary collapse
-
#allowed_starts_with ⇒ Object
Returns the value of attribute allowed_starts_with.
-
#authorize ⇒ Object
Returns the value of attribute authorize.
-
#autocomplete_cache_ttl_seconds ⇒ Object
Returns the value of attribute autocomplete_cache_ttl_seconds.
-
#autocomplete_max_columns_per_table ⇒ Object
Returns the value of attribute autocomplete_max_columns_per_table.
-
#autocomplete_max_tables ⇒ Object
Returns the value of attribute autocomplete_max_tables.
-
#current_actor ⇒ Object
Returns the value of attribute current_actor.
-
#enable_autocomplete ⇒ Object
Returns the value of attribute enable_autocomplete.
-
#enable_dml ⇒ Object
Returns the value of attribute enable_dml.
-
#enable_explain ⇒ Object
Returns the value of attribute enable_explain.
-
#enable_explain_analyze ⇒ Object
Returns the value of attribute enable_explain_analyze.
-
#enable_syntax_highlighting ⇒ Object
Returns the value of attribute enable_syntax_highlighting.
-
#enabled_environments ⇒ Object
Returns the value of attribute enabled_environments.
-
#forbidden_keywords ⇒ Object
Returns the value of attribute forbidden_keywords.
-
#max_rows ⇒ Object
Returns the value of attribute max_rows.
-
#schema_allowlist ⇒ Object
Returns the value of attribute schema_allowlist.
-
#schema_cache_seconds ⇒ Object
Returns the value of attribute schema_cache_seconds.
-
#schema_explorer ⇒ Object
Returns the value of attribute schema_explorer.
-
#schema_table_denylist ⇒ Object
Returns the value of attribute schema_table_denylist.
-
#timeout_ms ⇒ Object
Returns the value of attribute timeout_ms.
-
#timeout_strategy ⇒ Object
Returns the value of attribute timeout_strategy.
Instance Method Summary collapse
-
#autocomplete_enabled ⇒ Object
Validation: Autocomplete requires schema_explorer to be enabled.
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/query_console/configuration.rb', line 24 def initialize @enabled_environments = ["development"] @max_rows = 500 @timeout_ms = 3000 @timeout_strategy = :database # :database (safer, PostgreSQL only) or :ruby (fallback, but can leave orphan queries) @authorize = nil # nil means deny by default @current_actor = -> (_controller) { "unknown" } @forbidden_keywords = %w[ update delete insert drop alter create grant revoke truncate execute exec sp_executesql xp_ sp_ merge replace into shutdown backup restore transaction commit rollback ] @allowed_starts_with = %w[select with] # v0.2.0 additions @enable_explain = true @enable_explain_analyze = false # ANALYZE can be expensive, disabled by default @enable_dml = false # DML queries disabled by default for safety @schema_explorer = true @schema_cache_seconds = 60 @schema_table_denylist = ["schema_migrations", "ar_internal_metadata"] @schema_allowlist = [] # empty means all tables allowed (except denylist) @enable_syntax_highlighting = true @enable_autocomplete = true @autocomplete_max_tables = 100 @autocomplete_max_columns_per_table = 100 @autocomplete_cache_ttl_seconds = 300 # 5 minutes end |
Instance Attribute Details
#allowed_starts_with ⇒ Object
Returns the value of attribute allowed_starts_with.
3 4 5 |
# File 'lib/query_console/configuration.rb', line 3 def allowed_starts_with @allowed_starts_with end |
#authorize ⇒ Object
Returns the value of attribute authorize.
3 4 5 |
# File 'lib/query_console/configuration.rb', line 3 def @authorize end |
#autocomplete_cache_ttl_seconds ⇒ Object
Returns the value of attribute autocomplete_cache_ttl_seconds.
3 4 5 |
# File 'lib/query_console/configuration.rb', line 3 def autocomplete_cache_ttl_seconds @autocomplete_cache_ttl_seconds end |
#autocomplete_max_columns_per_table ⇒ Object
Returns the value of attribute autocomplete_max_columns_per_table.
3 4 5 |
# File 'lib/query_console/configuration.rb', line 3 def autocomplete_max_columns_per_table @autocomplete_max_columns_per_table end |
#autocomplete_max_tables ⇒ Object
Returns the value of attribute autocomplete_max_tables.
3 4 5 |
# File 'lib/query_console/configuration.rb', line 3 def autocomplete_max_tables @autocomplete_max_tables end |
#current_actor ⇒ Object
Returns the value of attribute current_actor.
3 4 5 |
# File 'lib/query_console/configuration.rb', line 3 def current_actor @current_actor end |
#enable_autocomplete ⇒ Object
Returns the value of attribute enable_autocomplete.
3 4 5 |
# File 'lib/query_console/configuration.rb', line 3 def enable_autocomplete @enable_autocomplete end |
#enable_dml ⇒ Object
Returns the value of attribute enable_dml.
3 4 5 |
# File 'lib/query_console/configuration.rb', line 3 def enable_dml @enable_dml end |
#enable_explain ⇒ Object
Returns the value of attribute enable_explain.
3 4 5 |
# File 'lib/query_console/configuration.rb', line 3 def enable_explain @enable_explain end |
#enable_explain_analyze ⇒ Object
Returns the value of attribute enable_explain_analyze.
3 4 5 |
# File 'lib/query_console/configuration.rb', line 3 def enable_explain_analyze @enable_explain_analyze end |
#enable_syntax_highlighting ⇒ Object
Returns the value of attribute enable_syntax_highlighting.
3 4 5 |
# File 'lib/query_console/configuration.rb', line 3 def enable_syntax_highlighting @enable_syntax_highlighting end |
#enabled_environments ⇒ Object
Returns the value of attribute enabled_environments.
3 4 5 |
# File 'lib/query_console/configuration.rb', line 3 def enabled_environments @enabled_environments end |
#forbidden_keywords ⇒ Object
Returns the value of attribute forbidden_keywords.
3 4 5 |
# File 'lib/query_console/configuration.rb', line 3 def forbidden_keywords @forbidden_keywords end |
#max_rows ⇒ Object
Returns the value of attribute max_rows.
3 4 5 |
# File 'lib/query_console/configuration.rb', line 3 def max_rows @max_rows end |
#schema_allowlist ⇒ Object
Returns the value of attribute schema_allowlist.
3 4 5 |
# File 'lib/query_console/configuration.rb', line 3 def schema_allowlist @schema_allowlist end |
#schema_cache_seconds ⇒ Object
Returns the value of attribute schema_cache_seconds.
3 4 5 |
# File 'lib/query_console/configuration.rb', line 3 def schema_cache_seconds @schema_cache_seconds end |
#schema_explorer ⇒ Object
Returns the value of attribute schema_explorer.
3 4 5 |
# File 'lib/query_console/configuration.rb', line 3 def schema_explorer @schema_explorer end |
#schema_table_denylist ⇒ Object
Returns the value of attribute schema_table_denylist.
3 4 5 |
# File 'lib/query_console/configuration.rb', line 3 def schema_table_denylist @schema_table_denylist end |
#timeout_ms ⇒ Object
Returns the value of attribute timeout_ms.
3 4 5 |
# File 'lib/query_console/configuration.rb', line 3 def timeout_ms @timeout_ms end |
#timeout_strategy ⇒ Object
Returns the value of attribute timeout_strategy.
3 4 5 |
# File 'lib/query_console/configuration.rb', line 3 def timeout_strategy @timeout_strategy end |
Instance Method Details
#autocomplete_enabled ⇒ Object
Validation: Autocomplete requires schema_explorer to be enabled
54 55 56 |
# File 'lib/query_console/configuration.rb', line 54 def autocomplete_enabled enable_autocomplete && schema_explorer end |