Replies: 2 comments 4 replies
-
Hi @TastyPi thanks for starting the discussion. I spoke a bit with my team about this and we're not quite ready to support this. Having packages dynamically load based on dependencies and other configuration will introduce a lot of complexity that we're not sure we'll be able to support in a satisfactory way (and Gusto wouldn't use this feature, making it hard for us to verify behavior from changeset to changeset). I have a couple of possible stop-gaps for you for the time being:
I wish I could give a more desirable answer for you here – let me know what you think. |
Beta Was this translation helpful? Give feedback.
-
I have just come across this need where we want to specify which packs get loaded based on a conditional (e.g. Environment variable) I don't suppose any more thought has been given to this since the last discussion or new ideas on how such a thing would be best implemented? (the links to PRs above have bitrotted). I basically ended up monkey-patching. module Packs
module Rails
module Integrations
class Rails
def inject_paths
Packs.all.reject(&:is_gem?).each do |pack|
next if included_packs.any? && included_packs.exclude?(pack.last_name)
Packs::Rails.config.paths.each do |path|
@app.paths[path] << pack.relative_path.join(path)
end
end
end
def included_packs
@included_packs ||= ENV["INCLUDE_PACKS"]&.split || []
end
end
end
end
end |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Currently
packs-rails
loads all packs, but it would be really useful for us if we could specify which packages were loaded. This would enable support for two things:2 is something I've been exploring but haven't fully fleshed out, basically we have a monolithic Rails app that supports multiple web apps and APIs that we would like to split out into separate servers, but with shared code loaded using
packs-rails
. This isn't really possible ifpacks-rails
always loads all packs.Would you be open to pull requests implementing this? My thinking for how to implement it would be to have a
package.yml
in the Rails app's root and use thedependencies
defined there as the packs that should be loaded, WDYT?Beta Was this translation helpful? Give feedback.
All reactions