Class: BunnyApp::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/bunny_app/install_generator.rb

Instance Method Summary collapse

Instance Method Details

#create_configuration_fileObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/generators/bunny_app/install_generator.rb', line 7

def create_configuration_file
  initializer 'bunny_app.rb' do
    <<~CONFIG
      # Specifies configuration options for the Bunny gem.
      BunnyApp.config do |c|

        # This is where your API credentials go. You should almost certainly not have it
        # committed to source control, but instead load it from a secret store.
        c.client_id = ENV['BUNNY_APP_CLIENT_ID']
        c.client_secret = ENV['BUNNY_APP_CLIENT_SECRET']
        c.scope = ENV['BUNNY_APP_SCOPE']

        # Base URI for the Bunny API
        c.base_uri = 'https://<subdomain>.bunny.com'

        # Optional.
        # Use this instead of client_id/secret if you dont care about the token expiring
        # c.access_token = ENV['BUNNY_APP_ACCESS_TOKEN']

      end
    CONFIG
  end
end