bard-api 0.3.2 → 0.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4aaf92f7575ac16f3e63cabf871e1a7d21732ef2a28bebddc84d1044e06624d2
4
- data.tar.gz: 81a07fcecb266586c89f954c7e14cbcc70ae9de1cf7a5422801a687c87b2c0f8
3
+ metadata.gz: 5356ba0a76baa3fea6495b9a18b831c1e584f68b558fb9e9807b42d47f4d592b
4
+ data.tar.gz: 240980678c50c10a37ee10e4a0de04955314be35361cc7ddb93adb8524eaf071
5
5
  SHA512:
6
- metadata.gz: d63a639cb55df2b3625b3aa8a802c073f97ac8e23629d131e2e46a44b2586347446155295687247f748cd9ac717170875b75824be481a34bcae28cfd846d425d
7
- data.tar.gz: 38ee9ca23f77e8c806175f4f03a2ff4528d43d26efbab3f811fbed19d0452c9f3a4cdeda307633e3fbeec948825e7d048c663b12424ab8bca136e0f7cbfa9e23
6
+ metadata.gz: 6218ddf87a7373a67469ac4e25dff989f65b2d3704d6ed23b4379740e7d4a231962cca7f3fd44f53c995096cd3a102d9d7248d0e655f7e5ada53c788e140efdd
7
+ data.tar.gz: 057fabfeb1a55b64dfbae9d16a3b917ff321d75faebb823dfc9618ab334d6ab2849cd81028452d159a5df558906603056c0abe630b706e272e534d00aa66c634
data/README.md CHANGED
@@ -98,6 +98,36 @@ Authorization: Bearer <jwt-token>
98
98
  }
99
99
  ```
100
100
 
101
+ #### GET /bard-api/config
102
+
103
+ Read the project's live backup and uptime configuration (requires JWT authentication). Used by axis to discover what each project actually has deployed.
104
+
105
+ **Headers:**
106
+ ```
107
+ Authorization: Bearer <jwt-token>
108
+ ```
109
+
110
+ **Response (200 OK):**
111
+ ```json
112
+ {
113
+ "project_name": "my-app",
114
+ "backup": {
115
+ "enabled": true,
116
+ "bard_managed": true,
117
+ "self_managed": false,
118
+ "encryption_enabled": true,
119
+ "destinations": [
120
+ { "name": "primary", "type": "s3" }
121
+ ]
122
+ },
123
+ "servers": {
124
+ "production": { "pings": ["https://my-app.example.com/health"] }
125
+ }
126
+ }
127
+ ```
128
+
129
+ Destination entries expose only `name` and `type`; bucket paths, regions, and credentials are never serialized. `servers` is `{}` when no production server is configured.
130
+
101
131
  ### Authentication
102
132
 
103
133
  The API uses JWT with asymmetric RSA keys for authentication. The public key is embedded in the gem, and only BARD Tracker with the private key can create valid tokens.
data/lib/bard/api/app.rb CHANGED
@@ -20,6 +20,8 @@ module Bard
20
20
  create_backup(request)
21
21
  when ["GET", "/backups/latest"]
22
22
  latest_backup(request)
23
+ when ["GET", "/config"]
24
+ config(request)
23
25
  else
24
26
  not_found
25
27
  end
@@ -53,6 +55,28 @@ module Bard
53
55
  json_response(404, { error: e.message })
54
56
  end
55
57
 
58
+ def config(request)
59
+ with_auth(request) do
60
+ json_response(200, serialize_config(Bard::Config.current))
61
+ end
62
+ end
63
+
64
+ def serialize_config(bard_config)
65
+ backup = bard_config.backup
66
+ production = bard_config.servers[:production]
67
+ {
68
+ project_name: bard_config.project_name,
69
+ backup: {
70
+ enabled: backup.enabled?,
71
+ bard_managed: backup.bard?,
72
+ self_managed: backup.self_managed?,
73
+ encryption_enabled: bard_config.respond_to?(:encrypt) && !!bard_config.encrypt,
74
+ destinations: backup.destinations.map { |d| { name: d[:name], type: d[:type] } },
75
+ },
76
+ servers: production ? { production: { pings: Array(production.ping) } } : {},
77
+ }
78
+ end
79
+
56
80
  def with_auth(request)
57
81
  payload = Auth.verify!(request.env["HTTP_AUTHORIZATION"])
58
82
  yield payload
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Bard
4
4
  module Api
5
- VERSION = "0.3.2"
5
+ VERSION = "0.4.0"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bard-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Micah Geisel
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-12-15 00:00:00.000000000 Z
10
+ date: 2026-05-15 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: jwt