class Star::Configuration

Provides an object to store global configuration settings.

This class is typically not used directly, but by calling {Star::Config#configure Star.configure}, which creates and updates a single instance of {Star::Configuration}.

@example Set the API access key id/secret access key for AWS S3:

Star.configure do |config|
  config.access_key_id = 'ABCDEFGHIJ1234567890'
  config.secret_access_key = 'ABCDEFGHIJ1234567890'
end

@see Star::Config for more examples.

An alternative way to set global configuration settings is by storing them in the following environment variables:

In case both methods are used together, {Star::Config#configure Star.configure} takes precedence.

@example Set the S3 access key id and secret access key:

ENV['AWS_ACCESS_KEY_ID'] = 'ABCDEFGHIJ1234567890'
ENV['AWS_SECRET_ACCESS_KEY'] = 'ABCDEFGHIJ1234567890'

Attributes

access_key_id[RW]

@return [String] the S3 access key ID.

bucket[RW]

@return [String] the name of the S3 bucket.

duration[RW]

@return [Integer] the number of seconds during which the URL returned by

calling #url on a remote file is publicly available.
location[RW]

@return [String] the path where remote files are uploaded to.

remote[RW]

@return [Booelan] whether to store files remotely or locally.

secret_access_key[RW]

@return [String] the S3 secret access key.

Public Class Methods

new() click to toggle source

Initialize the global configuration settings, using the values of the specified following environment variables by default.

# File lib/star/configuration.rb, line 54
def initialize
  @access_key_id = ENV['AWS_ACCESS_KEY_ID']
  @secret_access_key = ENV['AWS_SECRET_ACCESS_KEY']
  @bucket = ENV['AWS_BUCKET']
  @location = ENV.fetch('STAR_LOCATION', '/')
  @duration = ENV.fetch('STAR_DURATION', '30').to_i
  @remote = %w(1 t T true TRUE).include? ENV.fetch('STAR_REMOTE', 't')
end