Skip to content

Configuration files #2

@linqueta

Description

@linqueta

About configuration or settings files, my suggestion are these:

For core settings, we can have a settings.yml, like:

Path: config/activemessage/settings.yml

settings:
  aws:
    access_key_id: '<%= ENV['AWS_ACCESS_KEY_ID'] %>'
    secret_key: '<%= ENV['AWS_SECRET_KEY'] %>'
    region: '<%= ENV['AWS_REGION'] %>'
    account_id: '<%= ENV['AWS_ACCOUNT_ID'] %>'
    # Any kind of things that others gem for this organization needs
default:
  queues:
    # Settings for all queues
  topics:
    # Settings for all topics

For queues:

Path: Path: config/activemessage/queues/*.yml

default:
  queues:
    # Settings for all queues in this file
  topics:
    # Settings for all topics in this file
queues:
  - ...

For topics:

Path: Path: config/activemessage/topics/*.yml

default:
  queues:
    # Settings for all queues in this file
  topics:
    # Settings for all topics in this file
queues:
  - ...

About Configuration class, I really think that's it have to be open for others gems of this organization, so, this gems will can write data there.

My suggestion is something like that:

module ActiveMessage
  class << self
    def self.configurations
      @configurations ||= build_configurations!
    end

    private

    def build_configurations!
      # Call Reader and build configurations...
    end
  end
end

module ActiveMessage
  class Configuration
    attr_accessor :kind, :data

    def initialize
      @nested = []
    end

    def add_configuration(configuration)
      @nested << configuration
    end
  end
end

Using this way, we can have some kinds, like:

  • aws
  • queue
  • topic
  • subscription
  • default-queue
  • default-topic

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions