0
0
Fork 0
mirror of https://github.com/strukturag/nextcloud-spreed-signaling.git synced 2025-03-30 17:33:37 +00:00

sessions secrets: read with environment override

Signed-off-by: Adphi <philippe.adrien.nousse@gmail.com>
This commit is contained in:
Adphi 2025-01-28 13:30:42 +01:00
parent 76fa9abd33
commit bcac66cd7c
No known key found for this signature in database
GPG key ID: 46BE4062DB2397FF
2 changed files with 6 additions and 6 deletions

View file

@ -493,10 +493,10 @@ func main() {
log.Fatal("Could not read configuration: ", err)
}
secret, _ := config.GetString("backend", "secret")
secret, _ := signaling.GetStringOptionWithEnv(config, "backend", "secret")
backendSecret = []byte(secret)
hashKey, _ := config.GetString("sessions", "hashkey")
hashKey, _ := signaling.GetStringOptionWithEnv(config, "sessions", "hashkey")
switch len(hashKey) {
case 32:
case 64:
@ -504,7 +504,7 @@ func main() {
log.Printf("WARNING: The sessions hash key should be 32 or 64 bytes but is %d bytes", len(hashKey))
}
blockKey, _ := config.GetString("sessions", "blockkey")
blockKey, _ := signaling.GetStringOptionWithEnv(config, "sessions", "blockkey")
blockBytes := []byte(blockKey)
switch len(blockKey) {
case 0:

6
hub.go
View file

@ -187,7 +187,7 @@ type Hub struct {
}
func NewHub(config *goconf.ConfigFile, events AsyncEvents, rpcServer *GrpcServer, rpcClients *GrpcClients, etcdClient *EtcdClient, r *mux.Router, version string) (*Hub, error) {
hashKey, _ := config.GetString("sessions", "hashkey")
hashKey, _ := GetStringOptionWithEnv(config, "sessions", "hashkey")
switch len(hashKey) {
case 32:
case 64:
@ -195,7 +195,7 @@ func NewHub(config *goconf.ConfigFile, events AsyncEvents, rpcServer *GrpcServer
log.Printf("WARNING: The sessions hash key should be 32 or 64 bytes but is %d bytes", len(hashKey))
}
blockKey, _ := config.GetString("sessions", "blockkey")
blockKey, _ := GetStringOptionWithEnv(config, "sessions", "blockkey")
blockBytes := []byte(blockKey)
switch len(blockKey) {
case 0:
@ -207,7 +207,7 @@ func NewHub(config *goconf.ConfigFile, events AsyncEvents, rpcServer *GrpcServer
return nil, fmt.Errorf("the sessions block key must be 16, 24 or 32 bytes but is %d bytes", len(blockKey))
}
internalClientsSecret, _ := config.GetString("clients", "internalsecret")
internalClientsSecret, _ := GetStringOptionWithEnv(config, "clients", "internalsecret")
if internalClientsSecret == "" {
log.Println("WARNING: No shared secret has been set for internal clients.")
}