env_bro 0.1.3 โ 0.2.0
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 +4 -4
- data/README.md +21 -4
- data/app/controllers/env_bro/application_controller.rb +7 -1
- data/app/controllers/env_bro/home_controller.rb +2 -7
- data/app/helpers/env_bro/application_helper.rb +21 -13
- data/app/views/env_bro/audit/index.html.erb +28 -35
- data/app/views/env_bro/home/index.html.erb +25 -0
- data/app/views/env_bro/proposals/_new_key_row.html.erb +1 -1
- data/app/views/env_bro/proposals/new.html.erb +36 -34
- data/app/views/env_bro/reviews/new.html.erb +17 -20
- data/app/views/env_bro/reviews/show.html.erb +66 -78
- data/app/views/env_bro/shared/_page_styles.html.erb +57 -0
- data/app/views/env_bro/shared/forbidden.html.erb +3 -5
- data/app/views/env_bro/shared/not_ready.html.erb +16 -12
- data/lib/env_bro/configuration.rb +3 -2
- data/lib/env_bro/engine.rb +14 -0
- data/lib/env_bro/version.rb +1 -1
- data/lib/env_bro.rb +1 -0
- data/lib/generators/env_bro/install/install_generator.rb +8 -27
- metadata +17 -3
- data/app/views/env_bro/shared/_styles.html.erb +0 -151
- data/app/views/layouts/env_bro/application.html.erb +0 -38
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz: '
|
|
3
|
+
metadata.gz: 21f2b78d6abd4eaeaaa0b84ac0cbe8d56babd647e8423c2ea10820c9d906a28f
|
|
4
|
+
data.tar.gz: '0518eb15e9bab022daf9e5c272fffe85d0bf5938a838223a50690ad5efc65f8d'
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: cd24c5c8ac1ed1496281682f38a679e011f395243be0f48b6c825bad18ab0ad99812cfb15bc97024e0ad36dfdd9cf0a7b91708e064324513d0c576b38d1d6685
|
|
7
|
+
data.tar.gz: 4f745044caedfa94055356f6d164f0ce22c8319a8ec8a653861a1aa4b17a05b6cdcf1a4426e93f893f59aa4b590a39e04dc4dbd3b414ebc4aa9a9a0de4adf3ba
|
data/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Propose changes to Rails encrypted credentials without holding the keys.
|
|
4
4
|
|
|
5
5
|
EnvBro manages the credentials of the environment it runs in: on production it edits
|
|
6
|
-
`production.yml.enc`, on staging `staging.yml.enc`. Team members with permission open `/
|
|
6
|
+
`production.yml.enc`, on staging `staging.yml.enc`. Team members with permission open the BroHub dashboard (`/bro_hub/env_bro`),
|
|
7
7
|
pick keys to add, change or remove, and download the re-encrypted file. They commit it on a branch and open a PR. A reviewer uploads the
|
|
8
8
|
file from the PR and sees which keys changed, with values masked unless they choose to reveal them.
|
|
9
9
|
|
|
@@ -39,10 +39,27 @@ gem "env_bro", git: "https://github.com/rubydevro/env_bro.git"
|
|
|
39
39
|
```
|
|
40
40
|
|
|
41
41
|
```sh
|
|
42
|
-
bin/rails generate env_bro:install # initializer,
|
|
42
|
+
bin/rails generate env_bro:install # BroHub (mount + initializer), then EnvBro's initializer and migration. --mount-path=/bro_hub skips the question
|
|
43
43
|
bin/rails db:migrate
|
|
44
44
|
```
|
|
45
45
|
|
|
46
|
+
EnvBro's pages live in [BroHub](https://github.com/rubydevro/bro_hub), the shared dashboard shell for the Bro gems
|
|
47
|
+
(EnvBro, SafeBro, ...). You mount BroHub once and it mounts EnvBro under it:
|
|
48
|
+
|
|
49
|
+
```ruby
|
|
50
|
+
# config/routes.rb
|
|
51
|
+
mount BroHub::Engine => "/bro_hub" # EnvBro is at /bro_hub/env_bro
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
BroHub also owns "who is signed in": set `BroHub.config.current_user` once (see the BroHub README) and every Bro gem uses it.
|
|
55
|
+
`config.current_user` below only needs setting when EnvBro must differ.
|
|
56
|
+
|
|
57
|
+
### Upgrading from 0.1.x
|
|
58
|
+
|
|
59
|
+
Run `bin/rails generate bro_hub:install --remove-direct-mounts`: it mounts BroHub once and comments out the old direct `mount EnvBro::Engine => "..."` line. An old direct mount keeps working
|
|
60
|
+
(EnvBro then shows its own section in the same shell), so you can upgrade in two steps. Two things change in the UI:
|
|
61
|
+
the home page is now an environments overview instead of a redirect, and the layout comes from BroHub.
|
|
62
|
+
|
|
46
63
|
The generator wraps Rails' built-in `bin/rails env_bro:install:migrations`. Use that task on its own
|
|
47
64
|
to pick up new migrations after upgrading the gem.
|
|
48
65
|
|
|
@@ -59,7 +76,7 @@ EnvBro.configure do |config|
|
|
|
59
76
|
|
|
60
77
|
# Defaults shown:
|
|
61
78
|
# config.parent_controller = "::ApplicationController" # gives access to your auth
|
|
62
|
-
# config.current_user = ->(controller) { controller.send(:current_user) }
|
|
79
|
+
# config.current_user = ->(controller) { controller.send(:current_user) } # default: BroHub.config.current_user
|
|
63
80
|
# config.user_label = ->(user) { user.email }
|
|
64
81
|
# config.require_ssl = Rails.env.production?
|
|
65
82
|
# config.metadata_key = "env_bro"
|
|
@@ -108,7 +125,7 @@ what's wrong instead of the forms.
|
|
|
108
125
|
```sh
|
|
109
126
|
bundle install
|
|
110
127
|
bin/rails test # unit + integration tests
|
|
111
|
-
cd test/dummy && bin/rails s # http://localhost:3000
|
|
128
|
+
cd test/dummy && bin/rails s # http://localhost:3000, EnvBro in BroHub at /bro_hub, old direct mount at /admin/env
|
|
112
129
|
```
|
|
113
130
|
|
|
114
131
|
The dummy app comes with sample `development` and `test` credentials and keys in
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
module EnvBro
|
|
2
2
|
class ApplicationController < EnvBro.config.parent_controller.constantize
|
|
3
|
-
|
|
3
|
+
include BroHub::Layout
|
|
4
|
+
bro_hub_section :env_bro
|
|
4
5
|
|
|
5
6
|
protect_from_forgery with: :exception
|
|
6
7
|
|
|
@@ -18,6 +19,11 @@ module EnvBro
|
|
|
18
19
|
@env_bro_user = EnvBro.config.current_user.call(self)
|
|
19
20
|
end
|
|
20
21
|
|
|
22
|
+
# BroHub shows this name in the top bar, so it must be the same person EnvBro authorizes.
|
|
23
|
+
def bro_hub_user
|
|
24
|
+
env_bro_user
|
|
25
|
+
end
|
|
26
|
+
|
|
21
27
|
# permission: :create, :update, :destroy, :review or :reveal (higher ones include
|
|
22
28
|
# lower ones), or :propose for "any of create, update, destroy".
|
|
23
29
|
def env_bro_can?(permission)
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
module EnvBro
|
|
2
2
|
class HomeController < ApplicationController
|
|
3
|
+
before_action { raise EnvBro::Forbidden unless env_bro_can?(:propose) || env_bro_can?(:review) }
|
|
4
|
+
|
|
3
5
|
def index
|
|
4
|
-
if env_bro_can?(:propose)
|
|
5
|
-
redirect_to new_proposal_path
|
|
6
|
-
elsif env_bro_can?(:review)
|
|
7
|
-
redirect_to new_review_path
|
|
8
|
-
else
|
|
9
|
-
raise EnvBro::Forbidden
|
|
10
|
-
end
|
|
11
6
|
end
|
|
12
7
|
end
|
|
13
8
|
end
|
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
module EnvBro
|
|
2
2
|
module ApplicationHelper
|
|
3
|
+
# EnvBro's additions to BroHub's styles, once per page (and nonce-friendly).
|
|
4
|
+
def env_bro_styles
|
|
5
|
+
content_for(:head, render("env_bro/shared/page_styles")) unless content_for?(:head)
|
|
6
|
+
nil
|
|
7
|
+
end
|
|
8
|
+
|
|
3
9
|
def env_bro_masked(value)
|
|
4
|
-
return content_tag(:span, "(none)", class: "muted") if value.nil?
|
|
10
|
+
return content_tag(:span, "(none)", class: "bh-cell-muted") if value.nil?
|
|
5
11
|
length = env_bro_format_value(value).length
|
|
6
12
|
content_tag(:span, "โข" * [ length, 12 ].min, class: "mask", title: "#{length} characters") +
|
|
7
|
-
content_tag(:span, " #{length} chars", class: "muted
|
|
13
|
+
content_tag(:span, " #{length} chars", class: "bh-cell-muted")
|
|
8
14
|
end
|
|
9
15
|
|
|
10
16
|
def env_bro_value(value)
|
|
11
|
-
return content_tag(:span, "(none)", class: "muted") if value.nil?
|
|
17
|
+
return content_tag(:span, "(none)", class: "bh-cell-muted") if value.nil?
|
|
12
18
|
content_tag(:code, env_bro_format_value(value), class: "value")
|
|
13
19
|
end
|
|
14
20
|
|
|
@@ -16,20 +22,22 @@ module EnvBro
|
|
|
16
22
|
value.is_a?(String) ? value : value.to_json
|
|
17
23
|
end
|
|
18
24
|
|
|
25
|
+
STATUS_TAGS = { "added" => "is-green", "changed" => "is-amber", "removed" => "is-red", "unchanged" => "" }.freeze
|
|
26
|
+
|
|
19
27
|
def env_bro_status_badge(status)
|
|
20
|
-
content_tag(:span, status.to_s, class: "
|
|
28
|
+
content_tag(:span, status.to_s, class: [ "bh-tag", STATUS_TAGS[status.to_s], "tag-#{status}" ].compact_blank)
|
|
21
29
|
end
|
|
22
30
|
|
|
23
31
|
ENVIRONMENT_BADGES = {
|
|
24
|
-
ready: [ "ready", "
|
|
25
|
-
missing_file: [ "file missing", "
|
|
26
|
-
missing_key: [ "no key on server", "
|
|
27
|
-
wrong_key: [ "key doesn't match", "
|
|
32
|
+
ready: [ "ready", "is-green" ],
|
|
33
|
+
missing_file: [ "file missing", "is-red" ],
|
|
34
|
+
missing_key: [ "no key on server", "is-red" ],
|
|
35
|
+
wrong_key: [ "key doesn't match", "is-red" ]
|
|
28
36
|
}.freeze
|
|
29
37
|
|
|
30
38
|
def env_bro_environment_badge(status)
|
|
31
39
|
label, style = ENVIRONMENT_BADGES.fetch(status)
|
|
32
|
-
content_tag(:span, label, class: "
|
|
40
|
+
content_tag(:span, label, class: "bh-tag #{style}")
|
|
33
41
|
end
|
|
34
42
|
|
|
35
43
|
def env_bro_time(time)
|
|
@@ -39,10 +47,10 @@ module EnvBro
|
|
|
39
47
|
# Status of a proposal_created event: live / deployed / superseded / pending.
|
|
40
48
|
def env_bro_deployment_badge(proposal, live)
|
|
41
49
|
case proposal.deployment_status(live)
|
|
42
|
-
when :live then content_tag(:span, "live since #{env_bro_time(proposal.deployment.created_at)}", class: "
|
|
43
|
-
when :deployed then content_tag(:span, "deployed #{env_bro_time(proposal.deployment.created_at)}, replaced since", class: "
|
|
44
|
-
when :superseded then content_tag(:span, "superseded", class: "
|
|
45
|
-
else content_tag(:span, "not deployed yet", class: "
|
|
50
|
+
when :live then content_tag(:span, "live since #{env_bro_time(proposal.deployment.created_at)}", class: "bh-tag is-green")
|
|
51
|
+
when :deployed then content_tag(:span, "deployed #{env_bro_time(proposal.deployment.created_at)}, replaced since", class: "bh-tag")
|
|
52
|
+
when :superseded then content_tag(:span, "superseded", class: "bh-tag", title: "Never deployed. A newer proposal is live.")
|
|
53
|
+
else content_tag(:span, "not deployed yet", class: "bh-tag is-amber")
|
|
46
54
|
end
|
|
47
55
|
end
|
|
48
56
|
|
|
@@ -1,36 +1,29 @@
|
|
|
1
|
-
<%
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
<p class="muted">Who proposed, reviewed or revealed what, and when proposals went live. Key names only, never values.</p>
|
|
6
|
-
</div>
|
|
7
|
-
</div>
|
|
1
|
+
<% env_bro_styles %>
|
|
2
|
+
<% bro_hub_crumb "Audit log" %>
|
|
3
|
+
<%= bro_hub_hero eyebrow: "Audit log ยท #{@environment.name}", title: @events.size.to_s, subtitle: (@events.size == 1 ? "event" : "events"), tone: :green,
|
|
4
|
+
lead: "Who proposed, reviewed or revealed what, and when proposals went live. Key names only, never values." %>
|
|
8
5
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
<table>
|
|
14
|
-
<
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
<
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
</tbody>
|
|
34
|
-
</table>
|
|
35
|
-
<% end %>
|
|
36
|
-
</div>
|
|
6
|
+
<% if @events.empty? %>
|
|
7
|
+
<div class="bh-table-wrap"><div class="bh-empty">Nothing recorded yet.</div></div>
|
|
8
|
+
<% else %>
|
|
9
|
+
<div class="bh-table-wrap">
|
|
10
|
+
<div class="bh-table eb-cols-audit">
|
|
11
|
+
<div class="bh-row is-head"><span>When</span><span>Who</span><span>Event</span><span>Keys</span><span>Status</span></div>
|
|
12
|
+
<% @events.each do |event| %>
|
|
13
|
+
<div class="bh-row">
|
|
14
|
+
<span class="bh-cell-muted" title="<%= event.created_at.utc.iso8601 %>"><%= env_bro_time(event.created_at) %></span>
|
|
15
|
+
<span class="bh-cell-strong"><%= event.user_label %></span>
|
|
16
|
+
<span><span class="bh-tag"><%= event.event.humanize %></span></span>
|
|
17
|
+
<span><%= safe_join(event.keys, tag.br) %></span>
|
|
18
|
+
<span>
|
|
19
|
+
<% if event.event == "proposal_created" %>
|
|
20
|
+
<%= env_bro_deployment_badge(event, @live_proposal) %>
|
|
21
|
+
<% elsif event.modified_after_review? %>
|
|
22
|
+
<span class="bh-tag is-amber" title="The deployed file is not the one EnvBro built. It was re-encrypted after review.">modified after review</span>
|
|
23
|
+
<% end %>
|
|
24
|
+
</span>
|
|
25
|
+
</div>
|
|
26
|
+
<% end %>
|
|
27
|
+
</div>
|
|
28
|
+
</div>
|
|
29
|
+
<% end %>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<% env_bro_styles %>
|
|
2
|
+
<% bro_hub_crumb "Environments" %>
|
|
3
|
+
<%= bro_hub_hero eyebrow: "Encrypted credentials", title: "1", subtitle: "environment", tone: :green,
|
|
4
|
+
lead: "Pick an environment to propose a change. Existing values stay hidden." %>
|
|
5
|
+
|
|
6
|
+
<div class="bh-table-wrap">
|
|
7
|
+
<div class="bh-table eb-cols-envs">
|
|
8
|
+
<div class="bh-row is-head"><span>File</span><span>Keys</span><span>Groups</span><span>Last change</span><span>By</span></div>
|
|
9
|
+
<% credentials = (@environment.current_credentials if @environment.ready?) %>
|
|
10
|
+
<% meta = credentials&.metadata %>
|
|
11
|
+
<% meta = nil unless meta.is_a?(Hash) %>
|
|
12
|
+
<%= link_to (env_bro_can?(:propose) ? new_proposal_path : new_review_path), class: "bh-row eb-env-row" do %>
|
|
13
|
+
<span class="eb-env-name"><%= @environment.name %><small>.yml.enc</small></span>
|
|
14
|
+
<% if credentials %>
|
|
15
|
+
<span><%= credentials.key_paths.size %></span>
|
|
16
|
+
<span><%= credentials.outline.count(&:group) %></span>
|
|
17
|
+
<span class="bh-cell-muted"><%= meta&.fetch("proposed_at", nil).presence || "-" %></span>
|
|
18
|
+
<span><%= meta&.fetch("proposed_by", nil).presence || "-" %></span>
|
|
19
|
+
<% else %>
|
|
20
|
+
<span class="bh-cell-muted">-</span><span class="bh-cell-muted">-</span>
|
|
21
|
+
<span><%= env_bro_environment_badge(@environment.status) %></span><span></span>
|
|
22
|
+
<% end %>
|
|
23
|
+
<% end %>
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
autocomplete="off" spellcheck="false" aria-label="New key" class="mono" data-track>
|
|
4
4
|
<textarea name="new_keys[<%= index %>][secret_value]" rows="1" placeholder="Value"
|
|
5
5
|
autocomplete="off" spellcheck="false" aria-label="Value" data-track data-autogrow><%= change.value %></textarea>
|
|
6
|
-
<button type="button" class="icon-btn" data-remove-new-key title="Remove" aria-label="Remove this new key"
|
|
6
|
+
<button type="button" class="icon-btn" data-remove-new-key title="Remove" aria-label="Remove this new key">ร</button>
|
|
7
7
|
</div>
|
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
<%
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
<% env_bro_styles %>
|
|
2
|
+
<% bro_hub_crumb @environment.name, "Propose a change" %>
|
|
3
|
+
<% content_for :bro_hub_crumb_actions do %>
|
|
4
|
+
<%= bro_hub_crumb_link @environment.name, new_proposal_path, active: true %>
|
|
5
|
+
<% end %>
|
|
6
|
+
<% abilities = [] %>
|
|
7
|
+
<% abilities << "add new keys" if can_create? %>
|
|
8
|
+
<% abilities << "type a value to replace one" if can_update? %>
|
|
9
|
+
<% abilities << "tick <em>remove</em> to drop a key".html_safe if can_destroy? %>
|
|
10
|
+
<%= bro_hub_hero eyebrow: "#{@environment.filename} ยท #{@outline.count { |line| !line.group }} keys",
|
|
11
|
+
title: "Propose a change", subtitle: content_tag(:span, "to #{@environment.name}", class: "bh-tone-green"),
|
|
12
|
+
lead: safe_join([ "Existing values stay hidden. You can ", safe_join(abilities, ", "), "." ]) %>
|
|
13
13
|
|
|
14
14
|
<% if @error %>
|
|
15
|
-
<div class="
|
|
15
|
+
<div class="eb-banner is-error"><%= @error %></div>
|
|
16
16
|
<% end %>
|
|
17
17
|
|
|
18
18
|
<%= form_with url: proposal_path, method: :post, local: true, data: { proposal_form: true, turbo: false } do %>
|
|
19
19
|
<% if can_create? %>
|
|
20
|
-
<section class="
|
|
21
|
-
<div class="
|
|
22
|
-
<h2>Add new keys</h2>
|
|
23
|
-
<button type="button" class="
|
|
20
|
+
<section class="bh-block">
|
|
21
|
+
<div class="bh-block-head">
|
|
22
|
+
<h2 class="bh-h2">Add new keys</h2>
|
|
23
|
+
<button type="button" class="eb-add" data-add-new-key>+ Another key</button>
|
|
24
24
|
</div>
|
|
25
25
|
<div data-new-keys>
|
|
26
26
|
<% @new_keys.each_with_index do |change, i| %>
|
|
27
27
|
<%= render "new_key_row", change: change, index: i %>
|
|
28
28
|
<% end %>
|
|
29
29
|
</div>
|
|
30
|
-
<p class="
|
|
30
|
+
<p class="eb-note">Nest keys with dots: <code>stripe.publishable_key</code> goes under <code>stripe:</code>. A new group is created if needed.</p>
|
|
31
31
|
</section>
|
|
32
32
|
<% end %>
|
|
33
33
|
|
|
34
|
-
<section class="
|
|
35
|
-
<div class="
|
|
36
|
-
<h2><code><%= @environment.filename %></code></h2>
|
|
37
|
-
<input type="search" class="
|
|
34
|
+
<section class="bh-block">
|
|
35
|
+
<div class="bh-block-head">
|
|
36
|
+
<h2 class="bh-h2" style="text-transform:none"><code><%= @environment.filename %></code></h2>
|
|
37
|
+
<input type="search" class="bh-input" style="flex:0 1 260px" placeholder="Filter keysโฆ" data-filter aria-label="Filter keys">
|
|
38
38
|
</div>
|
|
39
39
|
|
|
40
40
|
<% if @outline.empty? %>
|
|
41
|
-
<p class="
|
|
41
|
+
<p class="bh-hint">This file has no keys yet.<%= " Add some above." if can_create? %></p>
|
|
42
42
|
<% else %>
|
|
43
|
-
<div class="
|
|
43
|
+
<div class="bh-log eb-keys">
|
|
44
44
|
<% index = 0 %>
|
|
45
45
|
<% @outline.each do |line| %>
|
|
46
46
|
<% if line.group %>
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
<textarea name="edits[<%= index %>][secret_value]" id="edit_<%= index %>" rows="1" placeholder="โขโขโขโขโขโข unchanged"
|
|
60
60
|
autocomplete="off" spellcheck="false" data-track data-autogrow<%= ' disabled' if removed %>><%= edit&.value unless removed %></textarea>
|
|
61
61
|
<% else %>
|
|
62
|
-
<span class="muted
|
|
62
|
+
<span class="bh-cell-muted">โขโขโขโขโขโข</span>
|
|
63
63
|
<% end %>
|
|
64
64
|
<% if can_destroy? %>
|
|
65
65
|
<label class="remove-toggle" title="Remove <%= line.path %>">
|
|
@@ -70,28 +70,30 @@
|
|
|
70
70
|
<% index += 1 %>
|
|
71
71
|
<% end %>
|
|
72
72
|
<% end %>
|
|
73
|
-
<p class="
|
|
73
|
+
<p class="bh-hint hidden" data-filter-empty>No keys match.</p>
|
|
74
74
|
</div>
|
|
75
75
|
<% end %>
|
|
76
76
|
</section>
|
|
77
77
|
|
|
78
|
-
<div class="
|
|
79
|
-
<span class="muted" data-summary>No changes yet</span>
|
|
80
|
-
<button type="submit" class="btn btn-primary" data-submit>Build & download <%= @environment.filename %></button>
|
|
81
|
-
</div>
|
|
82
|
-
|
|
83
|
-
<div id="download-notice" class="alert alert-ok" hidden>
|
|
78
|
+
<div id="download-notice" class="eb-banner is-ok" hidden>
|
|
84
79
|
<strong>Your download should start now.</strong> Next:
|
|
85
|
-
<ol class="steps
|
|
80
|
+
<ol class="eb-steps">
|
|
86
81
|
<li>Create a branch in the app repo.</li>
|
|
87
82
|
<li>Replace <code><%= env_bro_display_path(@environment.content_path) %></code> with the downloaded file.</li>
|
|
88
83
|
<li>Commit, push and open a pull request. Mention which keys you changed and why.</li>
|
|
89
84
|
<li>A reviewer checks it in EnvBro and merges.</li>
|
|
90
85
|
</ol>
|
|
91
|
-
<p class="
|
|
86
|
+
<p class="eb-note">If someone else's change merges first, build your file again. Encrypted files can't be merged.</p>
|
|
87
|
+
</div>
|
|
88
|
+
|
|
89
|
+
<div class="bh-sticky">
|
|
90
|
+
<span class="eb-summary" data-summary>No changes yet</span>
|
|
91
|
+
<button type="submit" class="bh-btn is-green is-auto" data-submit>Build & download <%= @environment.filename %></button>
|
|
92
92
|
</div>
|
|
93
93
|
<% end %>
|
|
94
94
|
|
|
95
95
|
<template id="new-key-template">
|
|
96
96
|
<%= render "new_key_row", change: EnvBro::Editor::Change.new(action: "set"), index: "__INDEX__" %>
|
|
97
97
|
</template>
|
|
98
|
+
|
|
99
|
+
<%= render "env_bro/shared/script" %>
|
|
@@ -1,32 +1,29 @@
|
|
|
1
|
-
<%
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
<p class="muted">Upload the <code><%= @environment.filename %></code> from the pull request to see which keys it changes.</p>
|
|
6
|
-
</div>
|
|
7
|
-
</div>
|
|
1
|
+
<% env_bro_styles %>
|
|
2
|
+
<% bro_hub_crumb @environment.name, "Review a proposed file" %>
|
|
3
|
+
<%= bro_hub_hero eyebrow: @environment.filename, title: "Review", subtitle: "a proposed file", tone: :green,
|
|
4
|
+
lead: safe_join([ "Upload the ", tag.code(@environment.filename), " from the pull request to see which keys it changes." ]) %>
|
|
8
5
|
|
|
9
6
|
<% if @error %>
|
|
10
|
-
<div class="
|
|
7
|
+
<div class="eb-banner is-error"><%= @error %></div>
|
|
11
8
|
<% end %>
|
|
12
9
|
|
|
13
10
|
<%= form_with url: review_path, method: :post, multipart: true, local: true, data: { turbo: false } do %>
|
|
14
|
-
<
|
|
11
|
+
<section class="bh-block eb-file">
|
|
15
12
|
<div class="field">
|
|
16
|
-
<label for="proposed_file">Proposed file
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
<label class="bh-field" for="proposed_file">Proposed file
|
|
14
|
+
<input type="file" name="proposed_file" id="proposed_file" accept=".enc" required class="bh-input">
|
|
15
|
+
</label>
|
|
16
|
+
<p class="eb-note">Download it from the PR branch, e.g. <code>git show my-branch:<%= env_bro_display_path(@environment.content_path) %> > <%= @environment.filename %></code>.</p>
|
|
19
17
|
</div>
|
|
20
18
|
|
|
21
|
-
<details class="
|
|
19
|
+
<details class="eb-details" style="margin-top:28px">
|
|
22
20
|
<summary>Compare against another version (optional)</summary>
|
|
23
|
-
<
|
|
24
|
-
<
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
</div>
|
|
21
|
+
<label class="bh-field" for="base_file">Base file
|
|
22
|
+
<input type="file" name="base_file" id="base_file" accept=".enc" class="bh-input">
|
|
23
|
+
</label>
|
|
24
|
+
<p class="eb-note">By default the proposal is compared with the file deployed on this server. Upload the file from <code>main</code> if it is ahead of what's deployed.</p>
|
|
28
25
|
</details>
|
|
29
26
|
|
|
30
|
-
<button type="submit" class="btn
|
|
31
|
-
</
|
|
27
|
+
<button type="submit" class="bh-btn is-green is-auto" style="margin-top:28px">Show changes</button>
|
|
28
|
+
</section>
|
|
32
29
|
<% end %>
|
|
@@ -1,109 +1,97 @@
|
|
|
1
|
-
<%
|
|
1
|
+
<% env_bro_styles %>
|
|
2
2
|
<% can_reveal = env_bro_can?(:reveal) %>
|
|
3
3
|
<% meta = @differ.proposed_metadata %>
|
|
4
4
|
<% changes = @differ.changes %>
|
|
5
5
|
<% unchanged = @differ.entries.reject(&:changed?) %>
|
|
6
|
+
<% bro_hub_crumb @environment.name, "Review" %>
|
|
7
|
+
<% content_for :bro_hub_crumb_actions do %><%= bro_hub_crumb_link "Review another file", new_review_path %><% end %>
|
|
6
8
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
<%= link_to "Review another file", new_review_path, class: "btn" %>
|
|
14
|
-
</div>
|
|
9
|
+
<%= bro_hub_hero eyebrow: "#{@environment.name} ยท #{@environment.filename}", title: changes.size.to_s,
|
|
10
|
+
subtitle: "changed #{changes.size == 1 ? 'key' : 'keys'}", tone: (changes.any? ? :amber : :green),
|
|
11
|
+
lead: safe_join([ "Proposed changes to #{@environment.name}, compared against the #{@base_enc ? 'uploaded base file' : 'file deployed on this server'} (",
|
|
12
|
+
tag.code(env_bro_short_digest(@base_digest)), ")." ]),
|
|
13
|
+
stats: [ [ @differ.counts[:added] || 0, "added", :green ], [ @differ.counts[:changed] || 0, "changed", :amber ],
|
|
14
|
+
[ @differ.counts[:removed] || 0, "removed", :red ] ] %>
|
|
15
15
|
|
|
16
16
|
<% case @base_status %>
|
|
17
17
|
<% when :current %>
|
|
18
|
-
<div class="
|
|
18
|
+
<div class="eb-banner is-ok">Built on the same version it is compared against. The diff below is exactly what this PR changes.</div>
|
|
19
19
|
<% when :stale %>
|
|
20
|
-
<div class="
|
|
20
|
+
<div class="eb-banner is-warn">
|
|
21
21
|
<strong>Outdated base.</strong> This file was built on version <code><%= env_bro_short_digest(meta["base_digest"]) %></code>,
|
|
22
22
|
not <code><%= env_bro_short_digest(@base_digest) %></code>. Changes made since then may be reverted by this PR. Look for unexpected removals or changes,
|
|
23
23
|
and ask the author to rebuild the file if in doubt.
|
|
24
24
|
</div>
|
|
25
25
|
<% else %>
|
|
26
|
-
<div class="
|
|
26
|
+
<div class="eb-banner is-warn">
|
|
27
27
|
<strong>Not built with EnvBro.</strong> The file has no EnvBro metadata, so it may have been edited by hand or be an older copy of the file.
|
|
28
28
|
Check every change below carefully.
|
|
29
29
|
</div>
|
|
30
30
|
<% end %>
|
|
31
31
|
|
|
32
|
-
<div class="split">
|
|
33
|
-
<div>
|
|
32
|
+
<div class="bh-split">
|
|
33
|
+
<div class="bh-split-main">
|
|
34
34
|
<%= form_with url: reveal_review_path, method: :post, local: true, data: { turbo: false } do %>
|
|
35
35
|
<%= hidden_field_tag :proposed_enc, @proposed_enc %>
|
|
36
36
|
<%= hidden_field_tag :base_enc, @base_enc %>
|
|
37
37
|
|
|
38
|
-
<div class="
|
|
39
|
-
<
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
</div>
|
|
38
|
+
<div class="bh-block-head">
|
|
39
|
+
<h2 class="bh-h2">Changed keys</h2>
|
|
40
|
+
<% if can_reveal && changes.any? %>
|
|
41
|
+
<button type="submit" name="reveal_key" value="*" class="eb-add">Reveal all values</button>
|
|
42
|
+
<% end %>
|
|
43
|
+
</div>
|
|
45
44
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
45
|
+
<div class="eb-summary-tags">
|
|
46
|
+
<% %i[added changed removed].each do |status| %>
|
|
47
|
+
<%= content_tag :span, "#{@differ.counts[status] || 0} #{status}", class: "bh-tag #{EnvBro::ApplicationHelper::STATUS_TAGS[status.to_s]}" %>
|
|
48
|
+
<% end %>
|
|
49
|
+
<span class="bh-tag"><%= unchanged.size %> unchanged</span>
|
|
50
|
+
</div>
|
|
52
51
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
<
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
<td class="nowrap">
|
|
70
|
-
<% unless revealed %>
|
|
71
|
-
<button type="submit" name="reveal_key" value="<%= entry.key %>" class="btn-link">reveal</button>
|
|
72
|
-
<% end %>
|
|
73
|
-
</td>
|
|
52
|
+
<% if changes.empty? %>
|
|
53
|
+
<p class="bh-hint">No key or value differs from the base file.</p>
|
|
54
|
+
<% else %>
|
|
55
|
+
<div class="bh-table eb-cols-diff<%= ' no-reveal' unless can_reveal %>" style="--min: 0">
|
|
56
|
+
<div class="bh-row is-head"><span>Key</span><span>Status</span><span>Before</span><span>After</span><% if can_reveal %><span></span><% end %></div>
|
|
57
|
+
<% changes.each do |entry| %>
|
|
58
|
+
<% revealed = @revealed.include?(entry.key) %>
|
|
59
|
+
<div class="bh-row row-<%= entry.status %> <%= { 'added' => 'bh-edge-violet', 'changed' => 'bh-edge-amber', 'removed' => 'bh-edge-red' }[entry.status.to_s] %>">
|
|
60
|
+
<span class="bh-cell-strong" style="font-family:var(--bh-mono);font-weight:500;font-size:14px;overflow-wrap:anywhere"><%= entry.key %></span>
|
|
61
|
+
<span><%= env_bro_status_badge(entry.status) %></span>
|
|
62
|
+
<span><%= revealed ? env_bro_value(entry.old_value) : env_bro_masked(entry.old_value) %></span>
|
|
63
|
+
<span><%= revealed ? env_bro_value(entry.new_value) : env_bro_masked(entry.new_value) %></span>
|
|
64
|
+
<% if can_reveal %>
|
|
65
|
+
<span>
|
|
66
|
+
<% unless revealed %>
|
|
67
|
+
<button type="submit" name="reveal_key" value="<%= entry.key %>" class="btn-link">reveal</button>
|
|
74
68
|
<% end %>
|
|
75
|
-
</
|
|
69
|
+
</span>
|
|
76
70
|
<% end %>
|
|
77
|
-
</
|
|
78
|
-
</table>
|
|
79
|
-
<% if can_reveal %>
|
|
80
|
-
<p class="hint mt-12">Revealing values is recorded in the audit log.</p>
|
|
71
|
+
</div>
|
|
81
72
|
<% end %>
|
|
73
|
+
</div>
|
|
74
|
+
<% if can_reveal %>
|
|
75
|
+
<p class="eb-note">Revealing values is recorded in the audit log.</p>
|
|
82
76
|
<% end %>
|
|
83
|
-
|
|
77
|
+
<% end %>
|
|
84
78
|
|
|
85
79
|
<% if unchanged.any? %>
|
|
86
|
-
<
|
|
87
|
-
<
|
|
88
|
-
|
|
89
|
-
<
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
<tr class="row-unchanged"><td class="key"><%= entry.key %></td></tr>
|
|
93
|
-
<% end %>
|
|
94
|
-
</tbody>
|
|
95
|
-
</table>
|
|
96
|
-
</details>
|
|
97
|
-
</div>
|
|
80
|
+
<details class="eb-details" style="margin-top:32px">
|
|
81
|
+
<summary><%= unchanged.size %> unchanged keys</summary>
|
|
82
|
+
<% unchanged.each do |entry| %>
|
|
83
|
+
<div class="eb-unchanged-key row-unchanged"><%= entry.key %></div>
|
|
84
|
+
<% end %>
|
|
85
|
+
</details>
|
|
98
86
|
<% end %>
|
|
99
87
|
<% end %>
|
|
100
88
|
</div>
|
|
101
89
|
|
|
102
|
-
<div>
|
|
103
|
-
<
|
|
104
|
-
<h2>Proposal</h2>
|
|
90
|
+
<div class="bh-split-aside">
|
|
91
|
+
<section class="bh-block">
|
|
92
|
+
<h2 class="bh-h2">Proposal</h2>
|
|
105
93
|
<% if meta %>
|
|
106
|
-
<dl class="
|
|
94
|
+
<dl class="bh-dl">
|
|
107
95
|
<dt>Author</dt><dd><%= meta["proposed_by"].presence || "unknown" %></dd>
|
|
108
96
|
<dt>Built at</dt><dd><%= meta["proposed_at"] %></dd>
|
|
109
97
|
<dt>Built on</dt><dd><code><%= env_bro_short_digest(meta["base_digest"]) %></code></dd>
|
|
@@ -112,23 +100,23 @@
|
|
|
112
100
|
<% end %>
|
|
113
101
|
</dl>
|
|
114
102
|
<% if Array(meta["changes"]).any? %>
|
|
115
|
-
<p class="
|
|
116
|
-
<ul class="steps">
|
|
103
|
+
<p class="eb-note">Changes declared by the author:</p>
|
|
104
|
+
<ul class="eb-steps">
|
|
117
105
|
<% Array(meta["changes"]).each do |c| %><li><code><%= c %></code></li><% end %>
|
|
118
106
|
</ul>
|
|
119
107
|
<% end %>
|
|
120
108
|
<% else %>
|
|
121
|
-
<p class="
|
|
109
|
+
<p class="bh-hint">No EnvBro metadata in this file.</p>
|
|
122
110
|
<% end %>
|
|
123
|
-
</
|
|
111
|
+
</section>
|
|
124
112
|
|
|
125
|
-
<
|
|
126
|
-
<h2>Before merging</h2>
|
|
127
|
-
<ol class="steps">
|
|
113
|
+
<section class="bh-block">
|
|
114
|
+
<h2 class="bh-h2">Before merging</h2>
|
|
115
|
+
<ol class="eb-steps">
|
|
128
116
|
<li>Every changed key is expected and matches the PR description.</li>
|
|
129
117
|
<li>No unexpected removals (a sign of an outdated or replaced file).</li>
|
|
130
118
|
<li>The PR changes only <code><%= @environment.filename %></code>, nothing else.</li>
|
|
131
119
|
</ol>
|
|
132
|
-
</
|
|
120
|
+
</section>
|
|
133
121
|
</div>
|
|
134
122
|
</div>
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
<%# What EnvBro's pages need on top of BroHub's shared styles. %>
|
|
2
|
+
<style<%= %( nonce="#{content_security_policy_nonce}").html_safe if content_security_policy_nonce %>>
|
|
3
|
+
.bh-main code { font: 500 .92em var(--bh-mono); color: var(--bh-text); overflow-wrap: anywhere; }
|
|
4
|
+
.hidden { display: none !important; }
|
|
5
|
+
.eb-cols-envs { --cols: minmax(200px, 1fr) 80px 80px 190px 130px; --min: 700px; }
|
|
6
|
+
.eb-cols-diff { --cols: minmax(150px, 1.2fr) 100px minmax(110px, 1fr) minmax(110px, 1fr) 80px; --min: 640px; }
|
|
7
|
+
.eb-cols-diff.no-reveal { --cols: minmax(150px, 1.2fr) 100px minmax(110px, 1fr) minmax(110px, 1fr); }
|
|
8
|
+
.eb-cols-audit { --cols: 170px 130px 150px minmax(180px, 1fr) minmax(170px, 1fr); --min: 840px; }
|
|
9
|
+
.eb-env-name { font: 700 20px var(--bh-sans); font-stretch: 85%; color: var(--bh-text); }
|
|
10
|
+
.eb-env-name small { font: 400 13px var(--bh-mono); color: var(--bh-muted); }
|
|
11
|
+
a.bh-row.eb-env-row:hover { border-left-color: var(--bh-green); }
|
|
12
|
+
.eb-keys { margin-top: 0; }
|
|
13
|
+
.eb-banner { padding: 14px var(--bh-pad); border-bottom: 1px solid var(--bh-line); border-left: 4px solid var(--bh-muted); font: 500 13px/1.5 var(--bh-mono); text-wrap: pretty; }
|
|
14
|
+
.eb-banner[hidden] { display: none; }
|
|
15
|
+
.eb-banner.is-ok { border-left-color: var(--bh-green); background: rgba(46, 204, 122, .08); }
|
|
16
|
+
.eb-banner.is-warn { border-left-color: var(--bh-amber); background: rgba(245, 184, 74, .1); }
|
|
17
|
+
.eb-banner.is-error { border-left-color: var(--bh-red); background: rgba(240, 79, 84, .12); }
|
|
18
|
+
.eb-banner strong { color: var(--bh-text); }
|
|
19
|
+
.eb-steps { margin: 12px 0 0; padding-left: 20px; line-height: 1.7; }
|
|
20
|
+
.eb-note { margin: 12px 0 0; font: 400 12px var(--bh-mono); color: var(--bh-muted); text-wrap: pretty; }
|
|
21
|
+
|
|
22
|
+
/* Propose a change */
|
|
23
|
+
.newkey-row { display: flex; flex-wrap: wrap; gap: 10px 20px; align-items: center; margin-bottom: 10px; }
|
|
24
|
+
.newkey-row input, .newkey-row textarea { background: transparent; border: 0; border-bottom: 2px solid var(--bh-text); color: var(--bh-text); font: 500 14px var(--bh-mono); padding: 10px 0; outline: none; min-width: 0; resize: none; overflow: hidden; }
|
|
25
|
+
.newkey-row input { flex: 1 1 220px; }
|
|
26
|
+
.newkey-row textarea { flex: 2 1 280px; }
|
|
27
|
+
.newkey-row input:focus, .newkey-row textarea:focus { border-bottom-color: var(--bh-green); }
|
|
28
|
+
.icon-btn { background: none; border: 0; cursor: pointer; font: 600 16px var(--bh-mono); color: var(--bh-muted); padding: 6px 8px; }
|
|
29
|
+
.icon-btn:hover { color: var(--bh-red); }
|
|
30
|
+
.eb-add { cursor: pointer; padding: 6px 10px; font: 600 12px var(--bh-mono); border: 1px solid var(--bh-green); background: transparent; color: var(--bh-green); }
|
|
31
|
+
.eb-add:hover { background: var(--bh-green); color: var(--bh-bg); }
|
|
32
|
+
.yaml-line.yaml-group { padding: 16px 0 6px 14px; font: 600 14px var(--bh-mono); color: var(--bh-violet-l); }
|
|
33
|
+
.yaml-line.yaml-leaf { display: grid; grid-template-columns: minmax(150px, 1fr) minmax(160px, 1.5fr) auto; gap: 16px; align-items: center; padding: 8px 0 8px 10px; border-bottom: 1px solid var(--bh-line); border-left: 4px solid transparent; }
|
|
34
|
+
.yaml-line.is-changed { border-left-color: var(--bh-violet); background: rgba(124, 109, 250, .12); }
|
|
35
|
+
.yaml-line.is-removed { border-left-color: var(--bh-red); background: rgba(240, 79, 84, .12); }
|
|
36
|
+
.yaml-key { font: 500 15px var(--bh-mono); overflow-wrap: anywhere; }
|
|
37
|
+
.yaml-key.depth-1 { padding-left: 24px; } .yaml-key.depth-2 { padding-left: 48px; } .yaml-key.depth-3 { padding-left: 72px; }
|
|
38
|
+
.yaml-key.depth-4 { padding-left: 96px; } .yaml-key.depth-5 { padding-left: 120px; } .yaml-key.depth-6 { padding-left: 144px; }
|
|
39
|
+
.is-removed .yaml-key { color: var(--bh-red); text-decoration: line-through; }
|
|
40
|
+
.yaml-leaf textarea { min-width: 0; background: transparent; border: 0; border-bottom: 1px solid var(--bh-line-2); color: var(--bh-text); font: 500 14px var(--bh-mono); padding: 8px 0; outline: none; resize: none; overflow: hidden; }
|
|
41
|
+
.yaml-leaf textarea:focus { border-bottom-color: var(--bh-violet); }
|
|
42
|
+
.yaml-leaf textarea:disabled { color: var(--bh-muted); }
|
|
43
|
+
.remove-toggle { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; padding: 6px 10px; font: 600 12px var(--bh-mono); border: 1px solid var(--bh-line-2); color: var(--bh-text); }
|
|
44
|
+
.remove-toggle input { accent-color: var(--bh-red); margin: 0; }
|
|
45
|
+
.is-removed .remove-toggle { border-color: var(--bh-red); background: var(--bh-red); color: var(--bh-bg); }
|
|
46
|
+
.eb-summary { font: 500 13px var(--bh-mono); color: var(--bh-muted); }
|
|
47
|
+
.eb-summary.has-changes { color: var(--bh-text); }
|
|
48
|
+
|
|
49
|
+
/* Review */
|
|
50
|
+
.mask { letter-spacing: .1em; }
|
|
51
|
+
.btn-link { background: none; border: 0; padding: 0; cursor: pointer; font: 600 12px var(--bh-mono); color: var(--bh-violet-l); text-decoration: underline; }
|
|
52
|
+
.eb-details summary { cursor: pointer; font: 600 13px var(--bh-mono); color: var(--bh-muted); }
|
|
53
|
+
.eb-details[open] summary { margin-bottom: 12px; }
|
|
54
|
+
.eb-file input[type="file"] { padding: 12px 0; font: 500 13px var(--bh-mono); color: var(--bh-text); border-bottom: 2px solid var(--bh-line-2); }
|
|
55
|
+
.eb-summary-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
|
|
56
|
+
.eb-unchanged-key { padding: 6px 0 6px 10px; border-bottom: 1px solid var(--bh-line); font: 500 13px var(--bh-mono); color: var(--bh-muted); }
|
|
57
|
+
</style>
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
<%
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
<p>You don't have permission to use this part of EnvBro. Ask an admin if you need access.</p>
|
|
5
|
-
</div>
|
|
1
|
+
<% bro_hub_crumb "Not allowed" %>
|
|
2
|
+
<%= bro_hub_hero eyebrow: "Access", title: "Not allowed", tone: :red,
|
|
3
|
+
lead: "You don't have permission to use this part of EnvBro. Ask an admin if you need access." %>
|
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
<% content_for :title, "Not available" %>
|
|
2
1
|
<% status = @environment.status %>
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
2
|
+
<% bro_hub_crumb @environment.name, "Not available" %>
|
|
3
|
+
<%= bro_hub_hero eyebrow: "#{@environment.name} credentials", title: "Not available", tone: :red,
|
|
4
|
+
lead: begin
|
|
5
|
+
case status
|
|
6
|
+
when :missing_file
|
|
7
|
+
safe_join([ "There is no credentials file at ", tag.code(env_bro_display_path(@environment.content_path)), " on this server." ])
|
|
8
|
+
when :missing_key
|
|
9
|
+
safe_join([ "This server has no key for ", tag.code(@environment.filename), ". Set ", tag.code(@environment.env_key),
|
|
10
|
+
" or add ", tag.code(env_bro_display_path(@environment.key_path)), "." ])
|
|
11
|
+
else
|
|
12
|
+
safe_join([ "The key on this server (", tag.code(@environment.env_key), " or ", tag.code(env_bro_display_path(@environment.key_path)),
|
|
13
|
+
") cannot decrypt ", tag.code(@environment.filename), "." ])
|
|
14
|
+
end
|
|
15
|
+
end do %>
|
|
16
|
+
<p style="margin-top:16px"><%= env_bro_environment_badge(status) %></p>
|
|
17
|
+
<% end %>
|
|
@@ -4,7 +4,7 @@ module EnvBro
|
|
|
4
4
|
# ApplicationController gives access to its authentication (current_user etc).
|
|
5
5
|
attr_accessor :parent_controller
|
|
6
6
|
|
|
7
|
-
# ->(controller) { ... } returning the signed in user, or nil.
|
|
7
|
+
# ->(controller) { ... } returning the signed in user, or nil. Defaults to BroHub.config.current_user.
|
|
8
8
|
attr_accessor :current_user
|
|
9
9
|
|
|
10
10
|
# ->(user) { ... } returning a short label for the audit log and file metadata.
|
|
@@ -52,7 +52,8 @@ module EnvBro
|
|
|
52
52
|
|
|
53
53
|
def initialize
|
|
54
54
|
@parent_controller = "::ApplicationController"
|
|
55
|
-
|
|
55
|
+
# Configured once for all Bro gems in BroHub.config.current_user, unless EnvBro needs its own.
|
|
56
|
+
@current_user = ->(controller) { BroHub.config.current_user.call(controller) }
|
|
56
57
|
@user_label = ->(user) { user.respond_to?(:email) ? user.email : user.to_s }
|
|
57
58
|
@can_create = ->(_user) { false }
|
|
58
59
|
@can_update = ->(_user) { false }
|
data/lib/env_bro/engine.rb
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
module EnvBro
|
|
2
|
+
# Items in the BroHub sidebar. Paths are relative to the engine.
|
|
3
|
+
BRO_HUB_ITEMS = [
|
|
4
|
+
{ label: "Environments", path: "/" },
|
|
5
|
+
{ label: "Propose a change", path: "/proposal/new" },
|
|
6
|
+
{ label: "Review", path: "/review/new", match: %r{\A/review} },
|
|
7
|
+
{ label: "Audit log", path: "/audit" }
|
|
8
|
+
].freeze
|
|
9
|
+
|
|
2
10
|
class Engine < ::Rails::Engine
|
|
3
11
|
isolate_namespace EnvBro
|
|
4
12
|
|
|
@@ -13,3 +21,9 @@ module EnvBro
|
|
|
13
21
|
end
|
|
14
22
|
end
|
|
15
23
|
end
|
|
24
|
+
|
|
25
|
+
# Registered when the gem loads, so it is in place before routes are drawn and BroHub can mount the engine.
|
|
26
|
+
# Showing a section is navigation only: every EnvBro controller still authorizes each request.
|
|
27
|
+
BroHub.register :env_bro, name: "EnvBro", label: "EnvBro ยท config", accent: :green,
|
|
28
|
+
engine: "EnvBro::Engine", order: 20, items: EnvBro::BRO_HUB_ITEMS,
|
|
29
|
+
visible_to: ->(user) { EnvBro.config.allows?(user, :propose) || EnvBro.config.allows?(user, :review) }
|
data/lib/env_bro/version.rb
CHANGED
data/lib/env_bro.rb
CHANGED
|
@@ -1,31 +1,21 @@
|
|
|
1
1
|
require "rails/generators"
|
|
2
|
+
require "generators/bro_hub/installable"
|
|
2
3
|
|
|
3
4
|
module EnvBro
|
|
4
5
|
module Generators
|
|
5
6
|
# bin/rails generate env_bro:install
|
|
6
7
|
class InstallGenerator < Rails::Generators::Base
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
desc "Adds the EnvBro initializer, mounts the engine and copies its migrations."
|
|
8
|
+
# BroHub first (one mount for all the Bro gems), then EnvBro itself.
|
|
9
|
+
include BroHub::Generators::Installable
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
source_root File.expand_path("templates", __dir__)
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
desc: "Where to mount EnvBro (asked interactively when omitted, default #{DEFAULT_MOUNT_PATH})"
|
|
13
|
+
desc "Sets up the BroHub dashboard, adds the EnvBro initializer and copies EnvBro's migrations."
|
|
15
14
|
|
|
16
15
|
def copy_initializer
|
|
17
16
|
copy_file "env_bro.rb", "config/initializers/env_bro.rb"
|
|
18
17
|
end
|
|
19
18
|
|
|
20
|
-
def mount_engine
|
|
21
|
-
routes = File.join(destination_root, "config/routes.rb")
|
|
22
|
-
if File.exist?(routes) && File.read(routes).include?("EnvBro::Engine")
|
|
23
|
-
say_status :skip, "EnvBro::Engine is already mounted", :yellow
|
|
24
|
-
else
|
|
25
|
-
route %(mount EnvBro::Engine => "#{mount_path}")
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
|
|
29
19
|
def copy_migrations
|
|
30
20
|
rails_command "env_bro:install:migrations", inline: true
|
|
31
21
|
end
|
|
@@ -36,20 +26,11 @@ module EnvBro
|
|
|
36
26
|
EnvBro is installed. Next:
|
|
37
27
|
1. bin/rails db:migrate
|
|
38
28
|
2. Set who may propose, review and reveal in config/initializers/env_bro.rb
|
|
39
|
-
3. Visit #{
|
|
29
|
+
3. Visit #{bro_hub_path}/env_bro (BroHub mounts EnvBro under its own path)
|
|
30
|
+
4. Upgrading from EnvBro 0.1.x? Run `bin/rails g bro_hub:install --remove-direct-mounts`, or remove the old
|
|
31
|
+
`mount EnvBro::Engine` line from config/routes.rb yourself. It keeps working until you do.
|
|
40
32
|
TEXT
|
|
41
33
|
end
|
|
42
|
-
|
|
43
|
-
private
|
|
44
|
-
# --mount-path wins; otherwise ask when someone is at the terminal.
|
|
45
|
-
def mount_path
|
|
46
|
-
@mount_path ||= begin
|
|
47
|
-
path = options[:mount_path].presence
|
|
48
|
-
path ||= ask("Where should EnvBro be mounted?", default: DEFAULT_MOUNT_PATH) if $stdin.tty?
|
|
49
|
-
path = path.to_s.strip.presence || DEFAULT_MOUNT_PATH
|
|
50
|
-
"/" + path.delete_prefix("/").delete_suffix("/")
|
|
51
|
-
end
|
|
52
|
-
end
|
|
53
34
|
end
|
|
54
35
|
end
|
|
55
36
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: env_bro
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ruby Dev SRL
|
|
@@ -23,6 +23,20 @@ dependencies:
|
|
|
23
23
|
- - ">="
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
25
|
version: '7.1'
|
|
26
|
+
- !ruby/object:Gem::Dependency
|
|
27
|
+
name: bro_hub
|
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
|
29
|
+
requirements:
|
|
30
|
+
- - ">="
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '0.1'
|
|
33
|
+
type: :runtime
|
|
34
|
+
prerelease: false
|
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - ">="
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: '0.1'
|
|
26
40
|
description: 'A mountable Rails engine: team members with permission build a re-encrypted
|
|
27
41
|
credentials file with their changes and open a PR; reviewers upload the file and
|
|
28
42
|
see a masked diff.'
|
|
@@ -44,15 +58,15 @@ files:
|
|
|
44
58
|
- app/models/env_bro/application_record.rb
|
|
45
59
|
- app/models/env_bro/audit_event.rb
|
|
46
60
|
- app/views/env_bro/audit/index.html.erb
|
|
61
|
+
- app/views/env_bro/home/index.html.erb
|
|
47
62
|
- app/views/env_bro/proposals/_new_key_row.html.erb
|
|
48
63
|
- app/views/env_bro/proposals/new.html.erb
|
|
49
64
|
- app/views/env_bro/reviews/new.html.erb
|
|
50
65
|
- app/views/env_bro/reviews/show.html.erb
|
|
66
|
+
- app/views/env_bro/shared/_page_styles.html.erb
|
|
51
67
|
- app/views/env_bro/shared/_script.html.erb
|
|
52
|
-
- app/views/env_bro/shared/_styles.html.erb
|
|
53
68
|
- app/views/env_bro/shared/forbidden.html.erb
|
|
54
69
|
- app/views/env_bro/shared/not_ready.html.erb
|
|
55
|
-
- app/views/layouts/env_bro/application.html.erb
|
|
56
70
|
- config/routes.rb
|
|
57
71
|
- db/migrate/20261029000000_create_env_bro_audit_events.rb
|
|
58
72
|
- lib/env_bro.rb
|
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
<style nonce="<%= content_security_policy_nonce %>">
|
|
2
|
-
:root {
|
|
3
|
-
--bg: #f6f7f9; --panel: #ffffff; --text: #1d2330; --muted: #6b7385; --border: #e1e4ea;
|
|
4
|
-
--accent: #3b5bdb; --accent-text: #ffffff; --danger: #c92a2a; --warn-bg: #fff4e0; --warn: #9a5b00;
|
|
5
|
-
--ok-bg: #e6f6ec; --ok: #1f7a3f; --code-bg: #f1f3f6;
|
|
6
|
-
--added: #1f7a3f; --added-bg: #e6f6ec; --removed: #c92a2a; --removed-bg: #fdecec;
|
|
7
|
-
--changed: #9a5b00; --changed-bg: #fff4e0;
|
|
8
|
-
--radius: 8px;
|
|
9
|
-
--mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
|
10
|
-
}
|
|
11
|
-
@media (prefers-color-scheme: dark) {
|
|
12
|
-
:root {
|
|
13
|
-
--bg: #12151b; --panel: #1b1f27; --text: #e4e7ee; --muted: #8d95a7; --border: #2c323d;
|
|
14
|
-
--accent: #6d8bff; --accent-text: #0d1020; --danger: #ff6b6b; --warn-bg: #3a2c12; --warn: #ffc566;
|
|
15
|
-
--ok-bg: #143122; --ok: #6fdc98; --code-bg: #232833;
|
|
16
|
-
--added: #6fdc98; --added-bg: #143122; --removed: #ff8787; --removed-bg: #3a1a1a;
|
|
17
|
-
--changed: #ffc566; --changed-bg: #3a2c12;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
* { box-sizing: border-box; }
|
|
21
|
-
body { margin: 0; background: var(--bg); color: var(--text);
|
|
22
|
-
font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
|
|
23
|
-
a { color: var(--accent); text-decoration: none; }
|
|
24
|
-
a:hover { text-decoration: underline; }
|
|
25
|
-
h1 { font-size: 1.5rem; margin: 0 0 4px; }
|
|
26
|
-
h2 { font-size: 1.1rem; margin: 0 0 12px; }
|
|
27
|
-
p { margin: 0 0 12px; }
|
|
28
|
-
code, .mono { font-family: var(--mono); font-size: .9em; }
|
|
29
|
-
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }
|
|
30
|
-
main.wrap { padding-top: 24px; padding-bottom: 64px; }
|
|
31
|
-
|
|
32
|
-
.topbar { background: var(--panel); border-bottom: 1px solid var(--border); }
|
|
33
|
-
.topbar-inner { display: flex; align-items: center; gap: 24px; height: 56px; }
|
|
34
|
-
.brand { font-weight: 700; color: var(--text); font-size: 1.05rem; }
|
|
35
|
-
.brand:hover { text-decoration: none; }
|
|
36
|
-
.nav { display: flex; gap: 16px; flex: 1; }
|
|
37
|
-
.nav a { color: var(--muted); }
|
|
38
|
-
.nav a:hover { color: var(--text); text-decoration: none; }
|
|
39
|
-
|
|
40
|
-
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
|
|
41
|
-
.muted { color: var(--muted); }
|
|
42
|
-
.small { font-size: .85rem; }
|
|
43
|
-
|
|
44
|
-
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; }
|
|
45
|
-
.split { display: grid; grid-template-columns: 1fr 320px; gap: 20px; align-items: start; }
|
|
46
|
-
@media (max-width: 820px) { .split { grid-template-columns: 1fr; } }
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 6px;
|
|
50
|
-
border: 1px solid var(--border); background: var(--panel); color: var(--text); font: inherit; font-size: .9rem;
|
|
51
|
-
cursor: pointer; line-height: 1.2; }
|
|
52
|
-
.btn:hover { text-decoration: none; border-color: var(--muted); }
|
|
53
|
-
.btn-primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }
|
|
54
|
-
.btn-primary:hover { filter: brightness(1.08); border-color: var(--accent); }
|
|
55
|
-
.btn-small { padding: 3px 8px; font-size: .8rem; }
|
|
56
|
-
.btn-link { background: none; border: none; color: var(--accent); padding: 0; cursor: pointer; font: inherit; font-size: .85rem; }
|
|
57
|
-
.btn-danger { color: var(--danger); }
|
|
58
|
-
.btn[disabled] { opacity: .5; cursor: not-allowed; }
|
|
59
|
-
|
|
60
|
-
label { display: block; font-weight: 600; font-size: .85rem; margin-bottom: 4px; }
|
|
61
|
-
input[type=text], input[type=search], select, textarea {
|
|
62
|
-
width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px;
|
|
63
|
-
background: var(--bg); color: var(--text); font: inherit; }
|
|
64
|
-
textarea { font-family: var(--mono); font-size: .85rem; min-height: 38px; resize: vertical; }
|
|
65
|
-
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
|
|
66
|
-
input[type=file] { font: inherit; font-size: .9rem; }
|
|
67
|
-
.field { margin-bottom: 16px; }
|
|
68
|
-
.hint { font-size: .8rem; color: var(--muted); margin-top: 4px; font-weight: normal; }
|
|
69
|
-
|
|
70
|
-
.alert { padding: 12px 14px; border-radius: 6px; margin-bottom: 16px; font-size: .9rem; }
|
|
71
|
-
.alert-error { background: var(--removed-bg); color: var(--removed); }
|
|
72
|
-
.alert-warn { background: var(--warn-bg); color: var(--warn); }
|
|
73
|
-
.alert-ok { background: var(--ok-bg); color: var(--ok); }
|
|
74
|
-
|
|
75
|
-
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
|
|
76
|
-
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
|
|
77
|
-
th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
|
|
78
|
-
tr:last-child td { border-bottom: none; }
|
|
79
|
-
td.key { font-family: var(--mono); font-size: .85rem; overflow-wrap: anywhere; min-width: 180px; }
|
|
80
|
-
td.nowrap, th.nowrap { white-space: nowrap; }
|
|
81
|
-
.row-added td.key { color: var(--added); }
|
|
82
|
-
.row-removed td.key { color: var(--removed); }
|
|
83
|
-
.row-changed td.key { color: var(--changed); }
|
|
84
|
-
.row-unchanged { color: var(--muted); }
|
|
85
|
-
|
|
86
|
-
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .75rem; font-weight: 600; }
|
|
87
|
-
.badge-added { background: var(--added-bg); color: var(--added); }
|
|
88
|
-
.badge-removed { background: var(--removed-bg); color: var(--removed); }
|
|
89
|
-
.badge-changed { background: var(--changed-bg); color: var(--changed); }
|
|
90
|
-
.badge-unchanged, .badge-neutral { background: var(--code-bg); color: var(--muted); }
|
|
91
|
-
.badge-ok { background: var(--ok-bg); color: var(--ok); }
|
|
92
|
-
.badge-danger { background: var(--removed-bg); color: var(--removed); }
|
|
93
|
-
|
|
94
|
-
.mask { letter-spacing: 2px; color: var(--muted); }
|
|
95
|
-
code.value { display: inline-block; background: var(--code-bg); padding: 2px 6px; border-radius: 4px;
|
|
96
|
-
white-space: pre-wrap; word-break: break-all; max-width: 100%; }
|
|
97
|
-
|
|
98
|
-
.panel-flush { padding: 0; overflow: hidden; }
|
|
99
|
-
.panel-pad { padding: 16px 20px 0; }
|
|
100
|
-
.filter { max-width: 240px; padding: 6px 10px; font-size: .85rem; }
|
|
101
|
-
.hidden { display: none !important; }
|
|
102
|
-
.icon-btn { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 1rem; padding: 6px; border-radius: 4px; }
|
|
103
|
-
.icon-btn:hover { color: var(--danger); background: var(--removed-bg); }
|
|
104
|
-
|
|
105
|
-
.newkey-row { display: grid; grid-template-columns: minmax(180px, 2fr) 3fr 32px; gap: 8px; margin-bottom: 8px; align-items: start; }
|
|
106
|
-
@media (max-width: 640px) { .newkey-row { grid-template-columns: 1fr 32px; } .newkey-row textarea { grid-column: 1; } }
|
|
107
|
-
|
|
108
|
-
/* Existing keys, laid out like the YAML file. */
|
|
109
|
-
.yaml { font-family: var(--mono); font-size: .875rem; border-top: 1px solid var(--border); margin-top: 16px; }
|
|
110
|
-
.yaml-line { display: grid; grid-template-columns: minmax(200px, 38%) 1fr auto; gap: 12px; align-items: center;
|
|
111
|
-
padding: 4px 20px; border-left: 3px solid transparent; }
|
|
112
|
-
.yaml-line:hover { background: var(--code-bg); }
|
|
113
|
-
.yaml-group { padding-top: 10px; padding-bottom: 2px; }
|
|
114
|
-
.yaml-group:hover { background: none; }
|
|
115
|
-
.yaml-group .yaml-key { color: var(--muted); font-weight: 600; }
|
|
116
|
-
.yaml-key { font-weight: normal; font-size: inherit; margin: 0; overflow-wrap: anywhere; cursor: text; }
|
|
117
|
-
.depth-1 { padding-left: 20px; } .depth-2 { padding-left: 40px; } .depth-3 { padding-left: 60px; }
|
|
118
|
-
.depth-4 { padding-left: 80px; } .depth-5 { padding-left: 100px; } .depth-6 { padding-left: 120px; }
|
|
119
|
-
.yaml-line textarea, .newkey-row textarea { resize: none; overflow: hidden; }
|
|
120
|
-
.yaml-line textarea { min-height: 32px; padding: 5px 10px; background: transparent; border-color: transparent; }
|
|
121
|
-
.yaml-line:hover textarea, .yaml-line textarea:focus { background: var(--bg); border-color: var(--border); }
|
|
122
|
-
.yaml-line textarea::placeholder { color: var(--muted); letter-spacing: 1px; }
|
|
123
|
-
.yaml-line.is-changed { border-left-color: var(--changed); background: var(--changed-bg); }
|
|
124
|
-
.yaml-line.is-changed .yaml-key { color: var(--changed); }
|
|
125
|
-
.yaml-line.is-changed textarea { background: var(--bg); border-color: var(--border); }
|
|
126
|
-
.yaml-line.is-removed { border-left-color: var(--removed); background: var(--removed-bg); }
|
|
127
|
-
.yaml-line.is-removed .yaml-key { color: var(--removed); text-decoration: line-through; }
|
|
128
|
-
.yaml-line.is-removed textarea { visibility: hidden; }
|
|
129
|
-
.remove-toggle { display: flex; align-items: center; gap: 4px; margin: 0; font: inherit; font-size: .8rem; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
|
130
|
-
font-weight: normal; color: var(--muted); cursor: pointer; white-space: nowrap; }
|
|
131
|
-
.yaml-line.is-removed .remove-toggle { color: var(--removed); }
|
|
132
|
-
.yaml .empty { font-family: inherit; }
|
|
133
|
-
|
|
134
|
-
.submitbar { position: sticky; bottom: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: 16px;
|
|
135
|
-
background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 20px; margin-bottom: 16px;
|
|
136
|
-
box-shadow: 0 -4px 16px rgba(0, 0, 0, .08); }
|
|
137
|
-
.submitbar [data-summary].has-changes { color: var(--text); font-weight: 600; }
|
|
138
|
-
|
|
139
|
-
.steps { margin: 0; padding-left: 20px; font-size: .9rem; }
|
|
140
|
-
.steps li { margin-bottom: 6px; overflow-wrap: anywhere; }
|
|
141
|
-
.meta { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; font-size: .9rem; margin: 0; }
|
|
142
|
-
.meta dt { color: var(--muted); }
|
|
143
|
-
.meta dd { margin: 0; }
|
|
144
|
-
.summary { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
|
|
145
|
-
.empty { text-align: center; padding: 32px; color: var(--muted); }
|
|
146
|
-
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
|
|
147
|
-
.toolbar h2 { margin: 0; }
|
|
148
|
-
.mt-12 { margin-top: 12px; }
|
|
149
|
-
.mt-16 { margin-top: 16px; margin-bottom: 0; }
|
|
150
|
-
details summary { cursor: pointer; color: var(--muted); font-size: .9rem; }
|
|
151
|
-
</style>
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8">
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
|
-
<meta name="robots" content="noindex, nofollow">
|
|
7
|
-
<title><%= content_for?(:title) ? "#{yield(:title)} ยท EnvBro" : "EnvBro" %></title>
|
|
8
|
-
<%= csrf_meta_tags %>
|
|
9
|
-
<%= csp_meta_tag %>
|
|
10
|
-
<%= render "env_bro/shared/styles" %>
|
|
11
|
-
</head>
|
|
12
|
-
<body>
|
|
13
|
-
<header class="topbar">
|
|
14
|
-
<div class="wrap topbar-inner">
|
|
15
|
-
<%= link_to root_path, class: "brand" do %>
|
|
16
|
-
<span class="brand-mark">๐</span> EnvBro
|
|
17
|
-
<% end %>
|
|
18
|
-
<span class="badge badge-neutral"><%= @environment.name %></span>
|
|
19
|
-
<nav class="nav">
|
|
20
|
-
<% if env_bro_can?(:propose) %><%= link_to "Propose", new_proposal_path %><% end %>
|
|
21
|
-
<% if env_bro_can?(:review) %>
|
|
22
|
-
<%= link_to "Review", new_review_path %>
|
|
23
|
-
<%= link_to "Audit log", audit_path %>
|
|
24
|
-
<% end %>
|
|
25
|
-
</nav>
|
|
26
|
-
<% if env_bro_user %>
|
|
27
|
-
<span class="whoami muted small"><%= EnvBro.config.user_label.call(env_bro_user) %></span>
|
|
28
|
-
<% end %>
|
|
29
|
-
</div>
|
|
30
|
-
</header>
|
|
31
|
-
|
|
32
|
-
<main class="wrap">
|
|
33
|
-
<%= yield %>
|
|
34
|
-
</main>
|
|
35
|
-
|
|
36
|
-
<%= render "env_bro/shared/script" %>
|
|
37
|
-
</body>
|
|
38
|
-
</html>
|