cloud/{apigw,lib/component}: add cockroachdb client, sample schema
This sets up some boilerplate to connect to CockroachDB servers,
including test in-memory servers.
We also add a first pass apigw user table schema, as the first user of
this new functionality. We exercise that, in turn, in a test.
We also rename component.Configuration to component.ComponentConfig.
There's a stutter in there, but it makes sense with
component.CockroachConfig alongside.
Change-Id: I76691146b87ce135d60db179b3f51eee16525df7
Reviewed-on: https://review.monogon.dev/c/monogon/+/912
Reviewed-by: Leopold Schabel <leo@monogon.tech>
Vouch-Run-CI: Leopold Schabel <leo@monogon.tech>
Tested-by: Jenkins CI
diff --git a/cloud/lib/component/devcerts.go b/cloud/lib/component/devcerts.go
index af1e3d3..4d8668d 100644
--- a/cloud/lib/component/devcerts.go
+++ b/cloud/lib/component/devcerts.go
@@ -18,7 +18,7 @@
// GetDevCerts returns paths to this component's development certificate, key
// and CA, or panics if unavailable.
-func (c *Configuration) GetDevCerts() (certPath, keyPath, caPath string) {
+func (c *ComponentConfig) GetDevCerts() (certPath, keyPath, caPath string) {
klog.Infof("Using developer certificates at %s", c.DevCertsPath)
caPath = c.ensureDevCA()
@@ -30,7 +30,7 @@
// component and returns paths to them. This data is either read from disk if it
// already exists, or is generated when this function is called. If any problem
// occurs, the code panics.
-func (c *Configuration) ensureDevComponent() (certPath, keyPath string) {
+func (c *ComponentConfig) ensureDevComponent() (certPath, keyPath string) {
caKeyPath := c.DevCertsPath + "/ca.key"
caCertPath := c.DevCertsPath + "/ca.cert"
@@ -113,7 +113,7 @@
// paths to them. This data is either read from disk if it already exists, or is
// generated when this function is called. If any problem occurs, the code
// panics.
-func (c *Configuration) ensureDevCA() (caCertPath string) {
+func (c *ComponentConfig) ensureDevCA() (caCertPath string) {
caKeyPath := c.DevCertsPath + "/ca.key"
caCertPath = c.DevCertsPath + "/ca.cert"