Class: RailsCloudTasks::Configuration
- Inherits:
-
Object
- Object
- RailsCloudTasks::Configuration
- Defined in:
- lib/rails_cloud_tasks/configuration.rb
Instance Attribute Summary collapse
-
#app_engine ⇒ Object
readonly
Returns the value of attribute app_engine.
-
#google_auth ⇒ Object
readonly
Returns the value of attribute google_auth.
-
#host ⇒ Object
Returns the value of attribute host.
-
#location_id ⇒ Object
Returns the value of attribute location_id.
- #project_id ⇒ Object
-
#scheduler_file_path ⇒ Object
Returns the value of attribute scheduler_file_path.
-
#scheduler_prefix_name ⇒ Object
Returns the value of attribute scheduler_prefix_name.
-
#service_account_email ⇒ Object
Returns the value of attribute service_account_email.
-
#tasks_path ⇒ Object
Returns the value of attribute tasks_path.
Instance Method Summary collapse
- #auth ⇒ Object
-
#initialize(app_engine = AppEngine, google_auth = Google::Auth) ⇒ Configuration
constructor
A new instance of Configuration.
- #inject_routes ⇒ Object
Constructor Details
#initialize(app_engine = AppEngine, google_auth = Google::Auth) ⇒ Configuration
Returns a new instance of Configuration.
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/rails_cloud_tasks/configuration.rb', line 9 def initialize(app_engine = AppEngine, google_auth = Google::Auth) @service_account_email = ENV['GCP_SERVICE_ACCOUNT'] @location_id = ENV['GCP_LOCATION'] @project_id = ENV['GCP_PROJECT'] @host = ENV['GCP_APP_ENDPOINT'] @tasks_path = '/tasks' @scheduler_file_path = './config/scheduler.yml' @scheduler_prefix_name = 'rails-cloud' @app_engine = app_engine @google_auth = google_auth end |
Instance Attribute Details
#app_engine ⇒ Object (readonly)
Returns the value of attribute app_engine.
7 8 9 |
# File 'lib/rails_cloud_tasks/configuration.rb', line 7 def app_engine @app_engine end |
#google_auth ⇒ Object (readonly)
Returns the value of attribute google_auth.
7 8 9 |
# File 'lib/rails_cloud_tasks/configuration.rb', line 7 def google_auth @google_auth end |
#host ⇒ Object
Returns the value of attribute host.
3 4 5 |
# File 'lib/rails_cloud_tasks/configuration.rb', line 3 def host @host end |
#location_id ⇒ Object
Returns the value of attribute location_id.
3 4 5 |
# File 'lib/rails_cloud_tasks/configuration.rb', line 3 def location_id @location_id end |
#project_id ⇒ Object
31 32 33 |
# File 'lib/rails_cloud_tasks/configuration.rb', line 31 def project_id @project_id ||= app_engine.project_id end |
#scheduler_file_path ⇒ Object
Returns the value of attribute scheduler_file_path.
3 4 5 |
# File 'lib/rails_cloud_tasks/configuration.rb', line 3 def scheduler_file_path @scheduler_file_path end |
#scheduler_prefix_name ⇒ Object
Returns the value of attribute scheduler_prefix_name.
3 4 5 |
# File 'lib/rails_cloud_tasks/configuration.rb', line 3 def scheduler_prefix_name @scheduler_prefix_name end |
#service_account_email ⇒ Object
Returns the value of attribute service_account_email.
3 4 5 |
# File 'lib/rails_cloud_tasks/configuration.rb', line 3 def service_account_email @service_account_email end |
#tasks_path ⇒ Object
Returns the value of attribute tasks_path.
3 4 5 |
# File 'lib/rails_cloud_tasks/configuration.rb', line 3 def tasks_path @tasks_path end |
Instance Method Details
#auth ⇒ Object
35 36 37 |
# File 'lib/rails_cloud_tasks/configuration.rb', line 35 def auth @auth ||= authenticate end |
#inject_routes ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/rails_cloud_tasks/configuration.rb', line 22 def inject_routes tasks_path = @tasks_path Rails.application.routes.append do post "#{tasks_path}/:job_class", to: RailsCloudTasks::Rack::Jobs post tasks_path, to: RailsCloudTasks::Rack::Tasks end end |