Class: Vert::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/vert/configuration.rb

Overview

Configuração central da gem. Todos os recursos são opcionais e ativados no initializer.

Examples:

config/initializers/vert.rb

Vert.configure do |config|
  config.enable_rls = true
  config.enable_outbox = true
  config.enable_health = true
  config.rabbitmq_url = ENV["RABBITMQ_URL"]
end

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/vert/configuration.rb', line 41

def initialize
  # Funcionalidades desativadas por padrão; ative no initializer conforme necessário
  @enable_rls = false
  @enable_outbox = false
  @enable_health = true
  @enable_authorization = false
  @enable_jwt_auth = false
  @enable_multi_tenant = false
  @enable_auditable = false
  @enable_soft_deletable = false
  @enable_uuid_primary_key = false
  @enable_company_scoped = false
  @enable_document_storeable = false

  # Production: set RABBITMQ_URL, DOCUMENT_SERVICE_URL, REDIS_URL via ENV; do not rely on defaults.
  @rls_user = ENV.fetch("RLS_USER", "app_user")
  @rabbitmq_url = ENV.fetch("RABBITMQ_URL", "amqp://vfarma:vfarma123@localhost:5672/")
  @exchange_name = ENV.fetch("RABBITMQ_EXCHANGE", "verticalerp.events")
  @document_service_url = ENV.fetch("DOCUMENT_SERVICE_URL", "http://localhost:3020")
  @health_check_path = "/health"
  @auto_mount_health_routes = false
  @health_check_database = true
  @health_check_redis = false
  @health_check_rabbitmq = false
  @health_check_sidekiq = false
end

Instance Attribute Details

#auto_mount_health_routesObject

— Health —



37
38
39
# File 'lib/vert/configuration.rb', line 37

def auto_mount_health_routes
  @auto_mount_health_routes
end

#document_service_urlObject

— Document service client —



34
35
36
# File 'lib/vert/configuration.rb', line 34

def document_service_url
  @document_service_url
end

#enable_auditableObject

— Flags de funcionalidade (todos opcionais) —



15
16
17
# File 'lib/vert/configuration.rb', line 15

def enable_auditable
  @enable_auditable
end

#enable_authorizationObject

— Flags de funcionalidade (todos opcionais) —



15
16
17
# File 'lib/vert/configuration.rb', line 15

def enable_authorization
  @enable_authorization
end

#enable_company_scopedObject

— Flags de funcionalidade (todos opcionais) —



15
16
17
# File 'lib/vert/configuration.rb', line 15

def enable_company_scoped
  @enable_company_scoped
end

#enable_document_storeableObject

— Flags de funcionalidade (todos opcionais) —



15
16
17
# File 'lib/vert/configuration.rb', line 15

def enable_document_storeable
  @enable_document_storeable
end

#enable_healthObject

— Flags de funcionalidade (todos opcionais) —



15
16
17
# File 'lib/vert/configuration.rb', line 15

def enable_health
  @enable_health
end

#enable_jwt_authObject

— Flags de funcionalidade (todos opcionais) —



15
16
17
# File 'lib/vert/configuration.rb', line 15

def enable_jwt_auth
  @enable_jwt_auth
end

#enable_multi_tenantObject

— Flags de funcionalidade (todos opcionais) —



15
16
17
# File 'lib/vert/configuration.rb', line 15

def enable_multi_tenant
  @enable_multi_tenant
end

#enable_outboxObject

— Flags de funcionalidade (todos opcionais) —



15
16
17
# File 'lib/vert/configuration.rb', line 15

def enable_outbox
  @enable_outbox
end

#enable_rlsObject

— Flags de funcionalidade (todos opcionais) —



15
16
17
# File 'lib/vert/configuration.rb', line 15

def enable_rls
  @enable_rls
end

#enable_soft_deletableObject

— Flags de funcionalidade (todos opcionais) —



15
16
17
# File 'lib/vert/configuration.rb', line 15

def enable_soft_deletable
  @enable_soft_deletable
end

#enable_uuid_primary_keyObject

— Flags de funcionalidade (todos opcionais) —



15
16
17
# File 'lib/vert/configuration.rb', line 15

def enable_uuid_primary_key
  @enable_uuid_primary_key
end

#exchange_nameObject

— RabbitMQ / Outbox —



31
32
33
# File 'lib/vert/configuration.rb', line 31

def exchange_name
  @exchange_name
end

#health_check_databaseObject

— Health —



37
38
39
# File 'lib/vert/configuration.rb', line 37

def health_check_database
  @health_check_database
end

#health_check_pathObject

— Health —



37
38
39
# File 'lib/vert/configuration.rb', line 37

def health_check_path
  @health_check_path
end

#health_check_rabbitmqObject

— Health —



37
38
39
# File 'lib/vert/configuration.rb', line 37

def health_check_rabbitmq
  @health_check_rabbitmq
end

#health_check_redisObject

— Health —



37
38
39
# File 'lib/vert/configuration.rb', line 37

def health_check_redis
  @health_check_redis
end

#health_check_sidekiqObject

— Health —



37
38
39
# File 'lib/vert/configuration.rb', line 37

def health_check_sidekiq
  @health_check_sidekiq
end

#rabbitmq_urlObject

— RabbitMQ / Outbox —



31
32
33
# File 'lib/vert/configuration.rb', line 31

def rabbitmq_url
  @rabbitmq_url
end

#rls_userObject

— RLS (Row Level Security) —



28
29
30
# File 'lib/vert/configuration.rb', line 28

def rls_user
  @rls_user
end