hephaestus 0.8.6 → 0.8.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b84d2eb6ebcc245c0337f26093cf46d89d08380b76584475891b6a5578e4fbda
4
- data.tar.gz: b983824e57e08c8fa71320a3605f256893cb3db63a94e2da7c2ed23876b735ae
3
+ metadata.gz: b3c1fc749a8387f060bd64519a41ff75516668a53e4960d2ad36b5f876b58d6d
4
+ data.tar.gz: 4818733c054814165462e31b131ca1edbfde01d2d1d34f8c0715a497421679c6
5
5
  SHA512:
6
- metadata.gz: 82a5dfd851446c1b4af1c8e375ffa8263fa5e375df692a07a7b22e4cf9f133d8fca0c82a0dcbe5d15d87a9a6ab2641353528b53aa6a403bdbafa1ec66073ed46
7
- data.tar.gz: f605a57f9faa0890bf5c4e2a85643aead84806957f46065f107854d78ab783ead7bbef24b644cde3f262284e0add2496038ac636d5b045a56a0134febe52ddc0
6
+ metadata.gz: 95ca846fca450e6df9221e933c28d041fabb91715b9b57f952951d350c50bf87bce4ce183495348c4df812133a8d068b41317855dc8f3e74457ca9664d4b463e
7
+ data.tar.gz: a6ca9a870d6e9423ca066c3c11541b1ef5d458b875f4f2f02e88e6f5c0ba3c30482a84f19e5b4f52b9a4d3e202338cc9b3486112db195267c100ffae87d3c6ce
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ # [v0.8.7] - 04-12-2024
2
+ ## What's Changed
3
+ * Load infra better by @gjtorikian in https://github.com/yettoapp/hephaestus/pull/77
4
+
5
+
6
+ **Full Changelog**: https://github.com/yettoapp/hephaestus/compare/v0.8.6...v0.8.7
1
7
  # [v0.8.6] - 03-12-2024
2
8
  **Full Changelog**: https://github.com/yettoapp/hephaestus/compare/v0.8.5...v0.8.6
3
9
  # [v0.8.5] - 03-12-2024
@@ -2,6 +2,7 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  OP_VAULT_SECRETS = {}
5
+ OP_INFRA_SECRETS = {}
5
6
 
6
7
  def fetch_vault_secret(label:, default:)
7
8
  if productionish?
@@ -11,9 +12,18 @@ def fetch_vault_secret(label:, default:)
11
12
  end
12
13
  end
13
14
 
14
- def op_load_vault_into_env(vault:, tag:)
15
+ def fetch_infra_secret(label:, default:)
16
+ if productionish?
17
+ OP_INFRA_SECRETS.delete(label) || raise("Secret `#{label}` not found in 1Password")
18
+ else
19
+ ENV.fetch(label, default.is_a?(Pathname) ? default.read : default)
20
+ end
21
+ end
22
+
23
+ def op_load_vault_into_env(vault:, tag: nil)
15
24
  include_sudo = !Rails.env.local? ? "sudo -E " : ""
16
- %x(#{include_sudo}op item list --vault #{vault} --tags #{tag} --format json | #{include_sudo}op item get - --reveal --format=json).tap do
25
+ include_tag = tag ? " --tags #{tag} " : ""
26
+ %x(#{include_sudo}op item list --vault #{vault}#{include_tag}--format json | #{include_sudo}op item get - --reveal --format=json).tap do
17
27
  raise "Failed to fetch value `#{vault}` for `#{tag}` from 1Password" unless $CHILD_STATUS.success?
18
28
  end
19
29
  end
@@ -22,6 +32,10 @@ def load_vault_secret(field)
22
32
  OP_VAULT_SECRETS[field["label"]] = field["value"].gsub("\\n", "\n")
23
33
  end
24
34
 
35
+ def load_infra_secret(field)
36
+ OP_INFRA_SECRETS[field["label"]] = field["value"].gsub("\\n", "\n")
37
+ end
38
+
25
39
  def productionish?
26
40
  Rails.env.production? || Rails.env.staging?
27
41
  end
@@ -87,6 +101,15 @@ module Hephaestus
87
101
  load_vault_secret(field)
88
102
  end
89
103
  end
104
+
105
+ res = JSON.parse(op_load_vault_into_env(vault: "Infra", tag: ENV["RAILS_ENV"]))
106
+ ["Common"].each do |section_label|
107
+ res["fields"].select { |f| f["section"] && f["section"]["label"] }.each do |field|
108
+ next unless field["section"]["label"] == section_label
109
+
110
+ load_infra_secret(field)
111
+ end
112
+ end
90
113
  end
91
114
 
92
115
  YETTO_API_URL = "#{YETTO_URL}/api"
@@ -5,7 +5,7 @@ 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"] = fetch_vault_secret(
8
+ ENV["OTEL_EXPORTER_OTLP_HEADERS"] = Hephaestus::Engine.fetch_infra_secret(
9
9
  label: "OTEL_EXPORTER_OTLP_HEADERS",
10
10
  default: "x-honeycomb-team=your-api-key",
11
11
  )
@@ -8,7 +8,7 @@ SlackWebhookLogger.setup do |config|
8
8
  #
9
9
  # The URL where messages will be sent.
10
10
  config.webhook_url = Hephaestus::Engine.fetch_infra_secret(
11
- label: "SLACK_#{Rails.env.upcase}_LOG_URL",
11
+ label: "SLACK_LOG_URL",
12
12
  default: "https://slack.com/the_log_room",
13
13
  )
14
14
 
@@ -2,7 +2,7 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Hephaestus
5
- VERSION = "0.8.6"
5
+ VERSION = "0.8.7"
6
6
  RAILS_VERSION = ">= 8.0"
7
7
  RUBY_VERSION = File
8
8
  .read("#{File.dirname(__FILE__)}/../../.ruby-version")
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hephaestus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.6
4
+ version: 0.8.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Garen Torikian
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-12-03 00:00:00.000000000 Z
11
+ date: 2024-12-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bootsnap