5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-23 08:36:22 +00:00

fix: recolectar variables de entorno

This commit is contained in:
f 2023-08-30 16:40:33 -03:00
parent 300ce15d27
commit 368a4e0848
No known key found for this signature in database
2 changed files with 17 additions and 16 deletions

View file

@ -66,14 +66,8 @@ class Deploy < ApplicationRecord
extra_env.merge({ extra_env.merge({
'HOME' => home_dir, 'HOME' => home_dir,
'PATH' => paths.join(':'), 'PATH' => paths.join(':'),
'SPREE_API_KEY' => site.tienda_api_key,
'SPREE_URL' => site.tienda_url,
'AIRBRAKE_PROJECT_ID' => site.id.to_s,
'AIRBRAKE_PROJECT_KEY' => site.airbrake_api_key,
'JEKYLL_ENV' => Rails.env, 'JEKYLL_ENV' => Rails.env,
'LANG' => ENV['LANG'], 'LANG' => ENV['LANG'],
'YARN_CACHE_FOLDER' => yarn_cache_dir,
'GEMS_SOURCE' => ENV['GEMS_SOURCE']
}) })
end end
@ -161,21 +155,14 @@ class Deploy < ApplicationRecord
@deploy_local ||= site.deploys.find_by(type: 'DeployLocal') @deploy_local ||= site.deploys.find_by(type: 'DeployLocal')
end end
def non_local_deploys
@non_local_deploys ||= site.deploys.where.not(type: 'DeployLocal')
end
# Consigue todas las variables de entorno configuradas por otros # Consigue todas las variables de entorno configuradas por otros
# deploys. # deploys.
# #
# @deprecated Solo tenía sentido para Distributed Press v0
# @return [Hash] # @return [Hash]
def extra_env def extra_env
@extra_env ||= @extra_env ||=
non_local_deploys.reduce({}) do |extra_env, deploy| site.deployment_list.reduce({}) do |extra, deploy|
extra_env.tap do |e| extra.merge deploy.local_env
e.merge! deploy.local_env
end
end end
end end
end end

View file

@ -62,6 +62,20 @@ class DeployLocal < Deploy
FileUtils.rm_rf(File.join(site.path, '.jekyll-cache')) FileUtils.rm_rf(File.join(site.path, '.jekyll-cache'))
end end
# Opciones necesarias para la compilación del sitio
#
# @return [Hash]
def local_env
@local_env ||= {
'SPREE_API_KEY' => site.tienda_api_key,
'SPREE_URL' => site.tienda_url,
'AIRBRAKE_PROJECT_ID' => site.id.to_s,
'AIRBRAKE_PROJECT_KEY' => site.airbrake_api_key,
'YARN_CACHE_FOLDER' => yarn_cache_dir,
'GEMS_SOURCE' => ENV['GEMS_SOURCE']
}
end
private private
def mkdir def mkdir
@ -143,7 +157,7 @@ class DeployLocal < Deploy
# @param :args [Hash] # @param :args [Hash]
# @return [String] # @return [String]
def extra_flags(**args) def extra_flags(**args)
non_local_deploys.map do |deploy| site.deployment_list.map do |deploy|
deploy.flags_for_build(**args) deploy.flags_for_build(**args)
end.compact.join(' ') end.compact.join(' ')
end end