From 6f2bd11f633f245d8c12e2b940a5f27dffe3bf09 Mon Sep 17 00:00:00 2001 From: pvincent Date: Thu, 13 Jun 2024 02:54:14 +0400 Subject: [PATCH] dotenv --- Gemfile | 1 + Gemfile.lock | 5 +++++ config/database.yml | 2 +- lib/formatters/ansi_formatter.rb | 5 +++-- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index 1d30cc8..6bb485b 100644 --- a/Gemfile +++ b/Gemfile @@ -16,6 +16,7 @@ gem 'tailwindcss-rails' group :development do gem 'amazing_print' gem 'debug' + gem 'dotenv-rails' gem 'error_highlight' gem 'htmlbeautifier' gem 'rails_live_reload' diff --git a/Gemfile.lock b/Gemfile.lock index 3771f71..d060cc1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -89,6 +89,10 @@ GEM debug (1.9.2) irb (~> 1.10) reline (>= 0.3.8) + dotenv (3.1.2) + dotenv-rails (3.1.2) + dotenv (= 3.1.2) + railties (>= 6.1) drb (2.2.1) error_highlight (0.6.0) erubi (1.12.0) @@ -308,6 +312,7 @@ DEPENDENCIES amazing_print bootsnap debug + dotenv-rails error_highlight htmlbeautifier importmap-rails diff --git a/config/database.yml b/config/database.yml index 6c59be4..093217d 100644 --- a/config/database.yml +++ b/config/database.yml @@ -1,7 +1,7 @@ --- default: &default - host: <%= ENV.include?('container_hostname')? 'ct1.lxd':'localhost' %> # MIAOU awareness + host: <%= ENV.fetch("DB_HOST") { 'localhost' } %> database: &db_name easy-going-rails user: *db_name password: *db_name diff --git a/lib/formatters/ansi_formatter.rb b/lib/formatters/ansi_formatter.rb index 2daf463..6259e48 100644 --- a/lib/formatters/ansi_formatter.rb +++ b/lib/formatters/ansi_formatter.rb @@ -30,7 +30,6 @@ class AnsiFormatter < SemanticLogger::Formatters::Color end def call(log, logger) - # puts caller_locations(1, 15) log = alter(log) self.log = log @@ -41,7 +40,9 @@ class AnsiFormatter < SemanticLogger::Formatters::Color end def reject(log) - true if log.name == 'ActionView::Base' && log.message.starts_with?(' Rendering') + return true if log.name == 'ActionView::Base' && log.message.starts_with?(' Rendering') + + true if log.name == 'Rails' && log.message.starts_with?('Loaded') end private