Use schema config option instead of hostname

This commit is contained in:
Jon Staab
2025-09-25 12:12:13 -07:00
parent 909cc8813d
commit 3b652bdae4
3 changed files with 4 additions and 5 deletions
+2 -3
View File
@@ -23,6 +23,7 @@ Contains information for populating the relay's `nip11` document.
Required:
- `schema` - a string that identifies this relay. This cannot be changed, and must be usable as a sqlite identifier.
- `secret` - the nostr secret key of the relay. Will be used to populate the relay's NIP 11 `self` field and sign generated events.
Optional:
@@ -69,6 +70,7 @@ The below config file might be saved as `./config/my-relay.example.com` in order
```toml
[self]
name = "My relay"
schema = 'my_relay'
secret = "ce30b1831a4551f4cb7a984033c34ab96d8cf56ff50df9d0c27d9fa5422f2278"
[groups]
@@ -95,8 +97,5 @@ See `justfile` for defined commands.
## TODO
- [ ] Create a "schema" abstraction to namespace tables
- This resource should be passed to event stores as well as claims, redemptions, etc
- We might need to create a custom blossom backend since the prefixes for the two stores will collide
- [ ] Watch configuration files and hot reload
- [ ] Free up resources after instance inactivity
+1 -1
View File
@@ -22,7 +22,7 @@ func EnableBlossom(instance *Instance) {
store := &EventStore{
Schema: &Schema{
Name: slug.Make(instance.Host) + "_blossom__",
Name: slug.Make(config.Self.Schema) + "__blossom",
},
}
+1 -1
View File
@@ -42,7 +42,7 @@ func MakeInstance(hostname string) (*Instance, error) {
Config: config,
Events: &EventStore{
Schema: &Schema{
Name: slug.Make(hostname),
Name: slug.Make(config.Self.Schema) + "__events",
},
},
Relay: khatru.NewRelay(),