hephaestus 0.7.2.1 → 0.7.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d7c2f9d61793dbe5625865f819df27d6c9d63af6a8b62d24baad0179cb18292a
4
- data.tar.gz: 2b3b19c2cf731b161b8d669e82613ef734b3724580ffaed458912e16ea2dee4e
3
+ metadata.gz: aa434c3350cbeb0ba0f33457265f2f191196762b7b29d0857ed974cee9f8c008
4
+ data.tar.gz: 1ac324371d86e09c465918289d7ab64024d35ab3b3331de831816f37d150c6b8
5
5
  SHA512:
6
- metadata.gz: 0dab68747b8859e1f6d0b24bb2d5d3243f4bb0278602d132eaa4a822d18b7ffaf69b9f683edf1fe1af807bfced0e009010433095725c083582decf8b0a4116f8
7
- data.tar.gz: aaf595de123fbb62eb0582e05d94f3f437c2e0eca9564c563ec6485ba65aede1f690c8d91b266be5235c5755770136b7c46a7646c0b49006131dff1978b78c13
6
+ metadata.gz: 16c8f996fffbbda083c2c399e17691566a3b7a57ae83cf3f2653c7f8b01be60add0da975c47b99d5c7ce0ee3989dc92edab07396b320bf498fb29dc02d5eabb8
7
+ data.tar.gz: 7fac9568440247732d5c8f946f1992639d428c02424613e84a7be9f5b8f887cc17f6cd0598d1bd406d5fd4331c2078b2a187e7eff3fd6b99463b24565f761f66
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ # [v0.7.2.2] - 16-11-2024
2
+ ## What's Changed
3
+ * is not yet available by @gjtorikian in https://github.com/yettoapp/hephaestus/pull/33
4
+
5
+
6
+ **Full Changelog**: https://github.com/yettoapp/hephaestus/compare/v0.7.2.1...v0.7.2.2
1
7
  # [v0.7.2.1] - 16-11-2024
2
8
  ## What's Changed
3
9
  * include all files in the gem by @gjtorikian in https://github.com/yettoapp/hephaestus/pull/31
@@ -1,17 +1,28 @@
1
1
  # typed: false
2
2
  # frozen_string_literal: true
3
3
 
4
- def set_env_var(production:, staging:, local:)
5
- case Rails.env
6
- when "production"
7
- %x(op read "#{production}").chomp
8
- when "staging"
9
- %x(op read "#{staging}").chomp
4
+ def fetch_plug_env_secret(label:, default:)
5
+ case ENV["RAILS_ENV"]
6
+ when "production", "staging"
7
+ op_read("op://Plug-#{plug_name}/#{ENV["RAILS_ENV"].capitalize}/#{label}")
10
8
  else
11
- local
9
+ ENV.fetch(label.to_s, default)
12
10
  end
13
11
  end
14
12
 
13
+ def fetch_infra_secret(label:, default:)
14
+ case ENV["RAILS_ENV"]
15
+ when "production", "staging"
16
+ op_read("op://Infra/Global Secrets/#{label}")
17
+ else
18
+ ENV.fetch(label.to_s, default)
19
+ end
20
+ end
21
+
22
+ def op_read(label)
23
+ %x(op read "#{label}").chomp
24
+ end
25
+
15
26
  def productionish?
16
27
  Rails.env.production? || Rails.env.staging?
17
28
  end
@@ -66,29 +77,16 @@ module Hephaestus
66
77
  "web.yetto.test"
67
78
  end
68
79
 
69
- SLACK_LOG_URL = set_env_var(
70
- production: "op://Infra/Secrets/SLACK_LOG_URL",
71
- staging: "op://Infra/Secrets/SLACK_LOG_URL",
72
- local: ENV.fetch("SLACK_LOG_URL", "https://slack.com/the_log_room"),
80
+ SLACK_LOG_URL = fetch_infra_secret(
81
+ label: "SLACK_LOG_URL",
82
+ default: "https://slack.com/the_log_room",
73
83
  )
74
84
 
75
85
  YETTO_API_URL = "#{YETTO_URL}/api"
76
86
  YETTO_REDIRECT_URL = productionish? ? "#{PROTOCOL}#{YETTO_URL}" : "#{PROTOCOL}127.0.0.1:3000"
77
87
 
78
88
  # Every plug has these secrets
79
- YETTO_PLUG_PEM = set_env_var(
80
- production: "op://Plug-#{plug_name}/Production/YETTO_PLUG_PEM",
81
- staging: "op://Plug-#{plug_name}/Staging/YETTO_PLUG_PEM",
82
- local: ENV.fetch("YETTO_PLUG_PEM", Rails.root.join("test/fixtures/files/fake_pem_file/fake.pem").read),
83
- )
84
- YETTO_SIGNING_SECRET = set_env_var(
85
- production: "op://Plug-#{plug_name}/Production/YETTO_SIGNING_SECRET",
86
- staging: "op://Plug-#{plug_name}/Staging/YETTO_SIGNING_SECRET",
87
- local: ENV.fetch("YETTO_SIGNING_SECRET", "super-secret"),
88
- )
89
- YETTO_PLUG_ID = set_env_var(
90
- production: "op://Plug-#{plug_name}/Production/YETTO_PLUG_ID",
91
- staging: "op://Plug-#{plug_name}/Staging/YETTO_PLUG_ID",
92
- local: ENV.fetch("YETTO_PLUG_ID", "plug-id"),
93
- )
89
+ YETTO_PLUG_PEM = fetch_plug_env_secret(label: "YETTO_PLUG_PEM", default: Rails.root.join("test/fixtures/files/fake_pem_file/fake.pem").read)
90
+ YETTO_SIGNING_SECRET = fetch_plug_env_secret(label: "YETTO_SIGNING_SECRET", default: "super-secret")
91
+ YETTO_PLUG_ID = fetch_plug_env_secret(label: "YETTO_PLUG_ID", default: "plug-id")
94
92
  end
@@ -5,10 +5,9 @@ unless Rails.env.development?
5
5
  # establish the environment for OTEL
6
6
  ENV["OTEL_EXPORTER_OTLP_ENDPOINT"] = "https://api.honeycomb.io"
7
7
 
8
- ENV["OTEL_EXPORTER_OTLP_HEADERS"] = set_env_var(
9
- production: "op://Plug-#{plug_name}/Production/OTEL_EXPORTER_OTLP_HEADERS",
10
- staging: "op://Plug-#{plug_name}/Staging/OTEL_EXPORTER_OTLP_HEADERS",
11
- local: ENV.fetch("OTEL_EXPORTER_OTLP_HEADERS", "x-honeycomb-team=your-api-key"),
8
+ ENV["OTEL_EXPORTER_OTLP_HEADERS"] = fetch_plug_env_secret(
9
+ label: "OTEL_EXPORTER_OTLP_HEADERS",
10
+ default: "x-honeycomb-team=your-api-key",
12
11
  )
13
12
 
14
13
  ENV["OTEL_SERVICE_NAME"] = "plug-#{plug_shortname}-#{Rails.env}"
@@ -2,7 +2,7 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Hephaestus
5
- VERSION = "0.7.2.1"
5
+ VERSION = "0.7.2.2"
6
6
  RAILS_VERSION = ">= 8.0"
7
7
  RUBY_VERSION = File
8
8
  .read("#{File.dirname(__FILE__)}/../../.ruby-version")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hephaestus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.2.1
4
+ version: 0.7.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Garen Torikian