mercredi 16 novembre 2016

prevent rails server from launching if file doesnt exist

I have aws.yml

development:
  asset_host: 'abcd1234efgh@cloudfront.net'

I created assets.rb

AWS_CONFIG = Rails.application.config_for(:aws)
unless (AWS_CONFIG.nil? || AWS_CONFIG['asset_host'].nil?)
  Rails.application.config.asset_host = AWS_CONFIG['asset_host']
end

I am trying to implement the logic if aws.yml not exists then it should completely blow up and prevent the rails server from launching. Any idea how could i achieve that?

Aucun commentaire:

Enregistrer un commentaire