Rackup Equivalent to defined(Rails::Server)

118 Views Asked by At

I'm trying to run a method immediately on startup in my rails project. Previously I used the following for running locally

# application.rb
if defined?(Rails::Server)
  config.after_initialize do
    # Do stuff here
  end
end

While this works locally, we are now running on prod with bundle exec rackup, which returns false for the above statement. Is there something I can call in my Rails project to execute a method immediately on start from Rackup?

0

There are 0 best solutions below