Peter Kurfer
0014927ca9
- support both s3 & file storage backends - support imgproxy to scale images - manually tested with MinIO & local storage - fixed service discovery issue in APIGatey reconciler not detecting service changes - refactored defaults and env variable code to make it manageable again - add repo link to docs
57 lines
1.8 KiB
Go
57 lines
1.8 KiB
Go
/*
|
|
Copyright 2025 Peter Kurfer.
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License.
|
|
You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
*/
|
|
|
|
package supabase
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
|
)
|
|
|
|
type serviceConfig[TEnvKeys, TDefaults any] struct {
|
|
Name string
|
|
EnvKeys TEnvKeys
|
|
Defaults TDefaults
|
|
}
|
|
|
|
func (cfg serviceConfig[TEnvKeys, TDefaults]) ObjectName(obj metav1.Object) string {
|
|
return fmt.Sprintf("%s-%s", obj.GetName(), cfg.Name)
|
|
}
|
|
|
|
func (cfg serviceConfig[TEnvKeys, TDefaults]) ObjectMeta(obj metav1.Object) metav1.ObjectMeta {
|
|
return metav1.ObjectMeta{Name: cfg.ObjectName(obj), Namespace: obj.GetNamespace()}
|
|
}
|
|
|
|
var ServiceConfig = struct {
|
|
Postgrest serviceConfig[postgrestEnvKeys, postgrestConfigDefaults]
|
|
Auth serviceConfig[authEnvKeys, authConfigDefaults]
|
|
PGMeta serviceConfig[pgMetaEnvKeys, pgMetaDefaults]
|
|
Studio serviceConfig[studioEnvKeys, studioDefaults]
|
|
Storage serviceConfig[storageEnvApiKeys, storageApiDefaults]
|
|
ImgProxy serviceConfig[imgProxyEnvKeys, imgProxyDefaults]
|
|
Envoy envoyServiceConfig
|
|
JWT jwtConfig
|
|
}{
|
|
Postgrest: postgrestServiceConfig(),
|
|
Auth: authServiceConfig(),
|
|
PGMeta: pgMetaServiceConfig(),
|
|
Studio: studioServiceConfig(),
|
|
Storage: storageServiceConfig(),
|
|
ImgProxy: imgProxyServiceConfig(),
|
|
Envoy: newEnvoyServiceConfig(),
|
|
JWT: newJwtConfig(),
|
|
}
|