From 1da3a7b35749ae981dcb51053dc013afa1dd1a24 Mon Sep 17 00:00:00 2001 From: Dmitry Sinina Date: Sat, 24 Aug 2024 21:58:23 +0300 Subject: [PATCH] fix default routing simulation interface (#1536) * fix default routing simulation interface --- app/admin/cdr/cdrs.rb | 1 + app/views/routing_simulation/_form.html.erb | 2 +- config/initializers/_config.rb | 2 ++ config/yeti_web.yml.ci | 3 +++ config/yeti_web.yml.development | 2 ++ config/yeti_web.yml.distr | 2 ++ spec/config/yeti_web_spec.rb | 3 ++- 7 files changed, 13 insertions(+), 2 deletions(-) diff --git a/app/admin/cdr/cdrs.rb b/app/admin/cdr/cdrs.rb index c701b8a5a..aaa80934e 100644 --- a/app/admin/cdr/cdrs.rb +++ b/app/admin/cdr/cdrs.rb @@ -193,6 +193,7 @@ def scoped_collection routing_simulation: { auth_id: resource.customer_auth&.require_incoming_auth ? resource.orig_gw_id : nil, transport_protocol_id: proto, + interface: YetiConfig.routing_simulation_default_interface, remote_ip: resource.auth_orig_ip, remote_port: resource.auth_orig_port, src_number: resource.src_prefix_in, diff --git a/app/views/routing_simulation/_form.html.erb b/app/views/routing_simulation/_form.html.erb index 1abc00c64..76395811d 100644 --- a/app/views/routing_simulation/_form.html.erb +++ b/app/views/routing_simulation/_form.html.erb @@ -3,7 +3,7 @@ <%= form.inputs do %> <%= form.input :auth_id, label:"Authorized gateway", collection: Gateway.where("incoming_auth_password is not null and allow_origination"), as: :select, include_blank: 'None', input_html: { class: 'chosen' } %> <%= form.input :transport_protocol_id, collection: Equipment::TransportProtocol.all, as: :select, include_blank: false %> - <%= form.input :interface, input_html: { value: form.object.interface || 'primary' } %> + <%= form.input :interface, input_html: { value: form.object.interface || YetiConfig.routing_simulation_default_interface } %> <%= form.input :remote_ip %> <%= form.input :remote_port %> <%= form.input :pop_id, collection: Pop.all, as: :select, include_blank: false %> diff --git a/config/initializers/_config.rb b/config/initializers/_config.rb index acea2dfb4..598063b3a 100644 --- a/config/initializers/_config.rb +++ b/config/initializers/_config.rb @@ -33,6 +33,8 @@ def self.setting_files(config_root, _env) optional(:rec_format).value(Dry::Types['string'].enum('wav', 'mp3')) + optional(:routing_simulation_default_interface).filled(:string) + required(:cdr_export).schema do required(:dir_path).filled(:string) required(:delete_url).filled(:string) diff --git a/config/yeti_web.yml.ci b/config/yeti_web.yml.ci index 9a80a0fe8..78d7c0e7c 100644 --- a/config/yeti_web.yml.ci +++ b/config/yeti_web.yml.ci @@ -47,3 +47,6 @@ cryptomus: url_callback: 'https://your_domain.com/api/cryptomus_callbacks' url_return: 'https://example.com' + +routing_simulation_default_interface: internal + diff --git a/config/yeti_web.yml.development b/config/yeti_web.yml.development index 19f7032bf..d44ed54d8 100644 --- a/config/yeti_web.yml.development +++ b/config/yeti_web.yml.development @@ -43,3 +43,5 @@ keep_balance_notifications_days: 30 api_log_tags: - SOME_TAG_FOR_API_LOG + +routing_simulation_default_interface: internal diff --git a/config/yeti_web.yml.distr b/config/yeti_web.yml.distr index d0aefb5ba..80daba617 100644 --- a/config/yeti_web.yml.distr +++ b/config/yeti_web.yml.distr @@ -43,3 +43,5 @@ keep_expired_destinations_days: api_log_tags: - SOME_TAG_FOR_API_LOG + +routing_simulation_default_interface: internal diff --git a/spec/config/yeti_web_spec.rb b/spec/config/yeti_web_spec.rb index 282d50b8d..d9c1498df 100644 --- a/spec/config/yeti_web_spec.rb +++ b/spec/config/yeti_web_spec.rb @@ -52,7 +52,8 @@ merchant_id: a_kind_of(String), url_callback: a_kind_of(String), url_return: a_kind_of(String) - } + }, + routing_simulation_default_interface: a_kind_of(String) } end