Skip to content

Commit db59e74

Browse files
Merge pull request #1158 from code0-tech/#1128-add-protocol-endpoint
add protocol endpoint
2 parents caf6622 + dbb469a commit db59e74

14 files changed

Lines changed: 31 additions & 9 deletions

File tree

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ gem 'good_job', '~> 4.0'
7979
gem 'rotp'
8080

8181
gem 'grpc', '~> 1.67'
82-
gem 'tucana', '0.0.75'
82+
gem 'tucana', '0.0.76'
8383

8484
gem 'code0-identities', '~> 0.0.3'
8585

Gemfile.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ GEM
148148
base64
149149
fiber-storage
150150
logger
151-
grpc (1.82.0)
151+
grpc (1.83.0)
152152
google-protobuf (>= 3.25, < 5.0)
153153
googleapis-common-protos-types (~> 1.0)
154154
httparty (0.23.2)
@@ -601,7 +601,7 @@ GEM
601601
open3 (~> 0.2)
602602
tucana (~> 0.0, >= 0.0.72)
603603
tsort (0.2.0)
604-
tucana (0.0.75)
604+
tucana (0.0.76)
605605
grpc (~> 1.64)
606606
tzinfo (2.0.6)
607607
concurrent-ruby (~> 1.0)
@@ -662,7 +662,7 @@ DEPENDENCIES
662662
simplecov-cobertura (~> 3.0)
663663
test-prof (~> 1.0)
664664
triangulum (= 0.26.2)
665-
tucana (= 0.0.75)
665+
tucana (= 0.0.76)
666666
tzinfo-data
667667

668668
RUBY VERSION

app/graphql/types/runtime_module_definition_type.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ class RuntimeModuleDefinitionType < Types::BaseObject
99
field :endpoint, String, null: false, description: 'Endpoint path of the module definition'
1010
field :host, String, null: false, description: 'Host of the module definition endpoint'
1111
field :port, Types::BigIntType, null: false, description: 'Port of the module definition endpoint'
12+
field :protocol, String, null: false, description: 'Protocol of the module definition endpoint'
1213

1314
id_field RuntimeModuleDefinition
1415
timestamps

app/models/runtime_module_definition.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ class RuntimeModuleDefinition < ApplicationRecord
55

66
validates :host, presence: true, length: { maximum: 253 }
77
validates :endpoint, presence: true, length: { maximum: 2048 }
8+
validates :protocol, presence: true, length: { maximum: 255 }
89
validates :port, numericality: { only_integer: true, greater_than_or_equal_to: 0, less_than_or_equal_to: 65_535 }
910

1011
def nilify_attributes!(except = %w[id runtime_module_id created_at updated_at])

app/services/runtimes/grpc/modules/update_service.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,8 @@ def update_module_definitions(module_records, t)
126126
db_module_definitions[index].assign_attributes(
127127
host: endpoint.host,
128128
port: endpoint.port,
129-
endpoint: endpoint.endpoint
129+
endpoint: endpoint.endpoint,
130+
protocol: endpoint.protocol
130131
)
131132

132133
next if db_module_definitions[index].save
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# frozen_string_literal: true
2+
3+
class AddProtocolToRuntimeModuleDefinitions < Code0::ZeroTrack::Database::Migration[1.0]
4+
def change
5+
add_column :runtime_module_definitions, :protocol, :text, null: false, limit: 255 # rubocop:disable Rails/NotNullColumn
6+
end
7+
end
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0e26705576a3693d4c97e0b356d76dd1404bff272b550da59753960fe2e28d74

db/structure.sql

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -931,8 +931,10 @@ CREATE TABLE runtime_module_definitions (
931931
endpoint text NOT NULL,
932932
created_at timestamp with time zone NOT NULL,
933933
updated_at timestamp with time zone NOT NULL,
934+
protocol text NOT NULL,
934935
CONSTRAINT check_5328b69b6f CHECK ((char_length(host) <= 253)),
935-
CONSTRAINT check_5a8231f609 CHECK ((char_length(endpoint) <= 2048))
936+
CONSTRAINT check_5a8231f609 CHECK ((char_length(endpoint) <= 2048)),
937+
CONSTRAINT check_cdbfabb698 CHECK ((char_length(protocol) <= 255))
936938
);
937939

938940
CREATE SEQUENCE runtime_module_definitions_id_seq

docs/graphql/object/runtimemoduledefinition.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@ A runtime module definition endpoint
1313
| `host` | [`String!`](../scalar/string.md) | Host of the module definition endpoint |
1414
| `id` | [`RuntimeModuleDefinitionID!`](../scalar/runtimemoduledefinitionid.md) | Global ID of this RuntimeModuleDefinition |
1515
| `port` | [`BigInt!`](../scalar/bigint.md) | Port of the module definition endpoint |
16+
| `protocol` | [`String!`](../scalar/string.md) | Protocol of the module definition endpoint |
1617
| `updatedAt` | [`Time!`](../scalar/time.md) | Time when this RuntimeModuleDefinition was last updated |

spec/factories/runtime_module_definitions.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@
66
host { 'localhost' }
77
port { 3000 }
88
endpoint { '/runtime' }
9+
protocol { 'https' }
910
end
1011
end

0 commit comments

Comments
 (0)