Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configuration files #2

Open
linqueta opened this issue Jun 27, 2020 · 0 comments
Open

Configuration files #2

linqueta opened this issue Jun 27, 2020 · 0 comments

Comments

@linqueta
Copy link
Member

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant