Class: OpenC3::DefaultBridge

Inherits:
Migration show all
Defined in:
lib/openc3/migrations/20260704000000_default_bridge.rb

Overview

Ensure every existing scope has a DEFAULT bridge_microservice (the Iroh hub that lets openc3-app run COSMOS interfaces on the host). New scopes get one via ScopeModel#deploy; this backfills any scope created before that.

Class Method Summary collapse

Class Method Details

.runObject



22
23
24
25
26
27
28
29
30
31
32
# File 'lib/openc3/migrations/20260704000000_default_bridge.rb', line 22

def self.run
  ScopeModel.get_all_models(scope: nil).each do |scope, scope_model|
    name = "#{scope}__BRIDGE__DEFAULT"
    next if MicroserviceModel.get_model(name: name, scope: scope)

    microservice = BridgeModel.build_microservice(bridge_name: "DEFAULT", scope: scope, shard: scope_model.shard)
    microservice.create
    microservice.deploy
    Logger.info("Added DEFAULT bridge_microservice to scope #{scope}")
  end
end