Class: RubyPitaya::Main
- Inherits:
-
Object
- Object
- RubyPitaya::Main
- Defined in:
- lib/rubypitaya/core/main.rb
Instance Attribute Summary collapse
-
#bll ⇒ Object
readonly
Returns the value of attribute bll.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#redis_connector ⇒ Object
readonly
Returns the value of attribute redis_connector.
Instance Method Summary collapse
-
#initialize ⇒ Main
constructor
A new instance of Main.
Constructor Details
#initialize ⇒ Main
Returns a new instance of Main.
33 34 35 36 37 38 39 40 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 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/rubypitaya/core/main.rb', line 33 def initialize @setup = Setup.new @environment_name = @setup.fetch('rubypitaya.server.environment', 'development') @is_development_environment = @environment_name == 'development' @setup.auto_reload if @is_development_environment @log = Logger.new('/proc/self/fd/1') @log.level = Logger::INFO @log.formatter = proc do |severity, datetime, progname, msg| "#{msg}\n" end @application_files_importer = ApplicationFilesImporter.new @application_files_importer.import @application_files_importer.auto_reload if @is_development_environment @server_name = @setup['rubypitaya.server.name'] @service_uuid = SecureRandom.uuid @desktop_name = Socket.gethostname @etcd_prefix = @setup['rubypitaya.etcd.prefix'] @etcd_address = @setup['rubypitaya.etcd.url'] @etcd_lease_seconds = @setup['rubypitaya.etcd.leaseSeconds'].to_i @allow_reconnect = false @etcd_connector = EtcdConnector.new(@service_uuid, @desktop_name, @server_name, @etcd_prefix, @etcd_address, @allow_reconnect, @etcd_lease_seconds) @etcd_connector.connect @nats_address = @setup['rubypitaya.nats.url'] @nats_connector = NatsConnector.new(@nats_address, @service_uuid, @server_name) @redis_address = @setup['rubypitaya.redis.url'] @redis_connector = RedisConnector.new(@redis_address) @redis_connector.connect @database_config = DatabaseConfig.new @database_connector = DatabaseConnector.new(@database_config) @database_connector.connect @mongo_address = @setup['rubypitaya.mongo.url'] @mongo_user = @setup['rubypitaya.mongo.user'] @mongo_password = @setup['rubypitaya.mongo.pass'] @mongo_database_name = @setup['rubypitaya.mongo.database'] @mongo_connector = MongoConnector.new(@mongo_address, @mongo_user, @mongo_password, @mongo_database_name) @mongo_connector.connect @session = Session.new @postman = Postman.new(@nats_connector) @config = Config.new @config.auto_reload if @is_development_environment @bll = InstanceHolder.new @initializer_content = InitializerContent.new(@bll, @log, @redis_connector.redis, @mongo_connector.mongo, @setup, @config) @initializer_broadcast = InitializerBroadcast.new @initializer_broadcast.run(@initializer_content) @handler_router = HandlerRouter.new() run_http run_server end |
Instance Attribute Details
#bll ⇒ Object (readonly)
Returns the value of attribute bll.
31 32 33 |
# File 'lib/rubypitaya/core/main.rb', line 31 def bll @bll end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
31 32 33 |
# File 'lib/rubypitaya/core/main.rb', line 31 def config @config end |
#redis_connector ⇒ Object (readonly)
Returns the value of attribute redis_connector.
31 32 33 |
# File 'lib/rubypitaya/core/main.rb', line 31 def redis_connector @redis_connector end |