You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: set library-friendly defaults on server Config (#3156)
## Changes
* Add `default:"..."` tags for scalar `Config` fields whose CLI flag
default in `pkg/cmd/serve.go` is non-zero.
Closes#2502
---------
Co-authored-by: Maria Ines Parnisari <maria.ines.parnisari@authzed.com>
Copy file name to clipboardExpand all lines: CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,6 +21,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
21
21
- Tracing: When server is shutting down, flush traces. Also, elide the need for setting `OTEL_EXPORTER_OTLP_ENDPOINT`. (https://github.com/authzed/spicedb/pull/3108)
22
22
- Fixed a LookupSubjects issue in the query planner around the handling of wildcards in compound permissions (https://github.com/authzed/spicedb/pull/3140)
23
23
- MySQL: identifiers (object/subject IDs and relationship counter names) are now stored with a case-sensitive (binary) collation, matching the Postgres, CockroachDB, and Spanner datastores. Previously, identifiers differing only in letter case (e.g. `Foo` and `foo`) incorrectly collided in unique indexes and lookups. ⚠️ The migration rebuilds the `relation_tuple` table in place via `ALTER TABLE`, which can hold a metadata/table lock for a long time on large datasets — run the upgrade in a low-traffic window, or apply it with an online schema-change tool (e.g. gh-ost). (https://github.com/authzed/spicedb/pull/3161)
24
+
-`server.NewConfigWithOptionsAndDefaults` now populates `Config` and its embedded structs with the same defaults as the CLI flags, fixing zero-value behavior when embedding SpiceDB as a library. (https://github.com/authzed/spicedb/pull/3156)
// It also pre-allocates slice fields to empty (non-nil) values so the
205
+
// resulting Config matches what RegisterDatastoreFlags writes via
206
+
// StringSliceVar/StringArrayVar.
207
+
func (c*Config) SetDefaults() {
208
+
c.ReadConnPool=*DefaultReadConnPool()
209
+
c.WriteConnPool=*DefaultWriteConnPool()
210
+
c.ReadReplicaConnPool=*DefaultReadConnPool()
211
+
c.OldReadReplicaConnPool=*DefaultReadConnPool()
212
+
213
+
// CaveatTypeSet is hidden from DebugMap but RegisterDatastoreFlags
214
+
// initializes it from DefaultDatastoreConfig at line 223. Mirror that
215
+
// here so library users get the same value as CLI users.
216
+
ifc.CaveatTypeSet==nil {
217
+
c.CaveatTypeSet=caveattypes.Default.TypeSet
218
+
}
219
+
220
+
ifc.BootstrapFiles==nil {
221
+
c.BootstrapFiles= []string{}
222
+
}
223
+
ifc.ReadReplicaURIs==nil {
224
+
c.ReadReplicaURIs= []string{}
225
+
}
226
+
ifc.AllowedMigrations==nil {
227
+
c.AllowedMigrations= []string{}
228
+
}
229
+
ifc.RelationshipIntegrityExpiredKeys==nil {
230
+
c.RelationshipIntegrityExpiredKeys= []string{}
231
+
}
232
+
}
233
+
199
234
//go:generate go run github.com/ecordell/optgen -sensitive-field-name-matches uri,secure -output zz_generated.relintegritykey.options.go . RelIntegrityKey
0 commit comments