Skip to content

Commit

Permalink
Handle missing ingestion config
Browse files Browse the repository at this point in the history
  • Loading branch information
fbacall committed Jun 11, 2024
1 parent c8ee29e commit 65b22df
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def redis_url
def ingestion
return @ingestion if @ingestion
config_file = File.join(Rails.root, 'config', 'ingestion.yml')
@ingestion = YAML.safe_load(File.read(config_file)).deep_symbolize_keys! if File.exist?(config_file)
@ingestion = File.exist?(config_file) ? YAML.safe_load(File.read(config_file)).deep_symbolize_keys! : {}
end

def analytics_enabled
Expand Down
4 changes: 2 additions & 2 deletions lib/scraper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ def initialize(config = TeSS::Config.ingestion, log_file: nil)
logfile: nil,
loglevel: 0,
default_role: 'scraper_user',
username: nil,
username: 'scraper',
sources: []
})

@name = config[:name]
@log_file = log_file || Rails.root.join(config[:logfile]).open('w+')
@log_file = log_file || (config[:logfile] ? Rails.root.join(config[:logfile]).open('w+') : StringIO.new)
@log_level = config[:loglevel]
@default_role = config[:default_role]
@username = config[:username]
Expand Down

0 comments on commit 65b22df

Please sign in to comment.