Module: NurseAndrea::Sanitizer
- Defined in:
- lib/nurse_andrea/sanitizer.rb
Constant Summary collapse
- DISCOVERY_ALLOWLIST =
%i[type tech provider source variable_name].freeze
Class Method Summary collapse
Class Method Details
.extract_provider(url) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/nurse_andrea/sanitizer.rb', line 26 def self.extract_provider(url) host = URI.parse(url).host rescue nil return "unknown" unless host case host when /\.railway\.internal$/ then "railway" when /\.render\.com$/ then "render" when /\.fly\.dev$/ then "fly" when /\.neon\.tech$/ then "neon" when /\.supabase\.co$/ then "supabase" when /\.upstash\.io$/ then "upstash" when /\.mongodb\.net$/ then "mongodb_atlas" when /\.herokuapp\.com$/ then "heroku" when /\.elephantsql\.com$/ then "elephantsql" when /\.aws\.clickhouse\.cloud$/ then "clickhouse_cloud" else "self_hosted" end end |
.extract_tech(url) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/nurse_andrea/sanitizer.rb', line 14 def self.extract_tech(url) scheme = URI.parse(url).scheme rescue nil case scheme when "postgres", "postgresql" then "postgresql" when "mysql", "mysql2" then "mysql" when "redis", "rediss" then "redis" when "amqp", "amqps" then "rabbitmq" when "mongodb", "mongodb+srv" then "mongodb" else "unknown" end end |
.sanitize_discovery(raw) ⇒ Object
10 11 12 |
# File 'lib/nurse_andrea/sanitizer.rb', line 10 def self.sanitize_discovery(raw) raw.slice(*DISCOVERY_ALLOWLIST) end |