Add config for locker url

This commit is contained in:
Neeraj Gupta
2025-07-18 13:23:55 +05:30
parent 944bdfc7fa
commit 3aa419b430
3 changed files with 13 additions and 3 deletions

View File

@@ -98,6 +98,7 @@ func main() {
}
viper.SetDefault("apps.public-albums", "https://albums.ente.io")
viper.SetDefault("apps.public-locker", "https://locker.ente.io")
viper.SetDefault("apps.accounts", "https://accounts.ente.io")
viper.SetDefault("apps.cast", "https://cast.ente.io")
viper.SetDefault("apps.family", "https://family.ente.io")
@@ -179,6 +180,7 @@ func main() {
familyRepo := &repo.FamilyRepository{DB: db}
trashRepo := &repo.TrashRepository{DB: db, ObjectRepo: objectRepo, FileRepo: fileRepo, QueueRepo: queueRepo}
collectionLinkRepo := public.NewCollectionLinkRepository(db, viper.GetString("apps.public-albums"))
fileLinkRepo := public.NewFileLinkRepo(db)
collectionRepo := &repo.CollectionRepository{DB: db, FileRepo: fileRepo, CollectionLinkRepo: collectionLinkRepo,
TrashRepo: trashRepo, SecretEncryptionKey: secretEncryptionKeyBytes, QueueRepo: queueRepo, LatencyLogger: latencyLogger}
pushRepo := &repo.PushTokenRepository{DB: db}
@@ -430,7 +432,7 @@ func main() {
}
fileLinkCtrl := &publicCtrl.FileLinkController{
FileController: fileController,
FileLinkRepo: nil,
FileLinkRepo: fileLinkRepo,
FileRepo: fileRepo,
JwtSecret: jwtSecretBytes,
}

View File

@@ -79,9 +79,14 @@ http:
apps:
# Default is https://albums.ente.io
#
# If you're running a self hosted instance and wish to serve public links,
# If you're running a self hosted instance and wish to serve public links for photos,
# set this to the URL where your albums web app is running.
public-albums:
# Default is https://locker.ente.io
#
# If you're running a self-hosted instance and wish to serve public links for locker,
# set this to the URL where your albums web app is running.
public-locker:
# Default is https://cast.ente.io
cast:
# Default is https://accounts.ente.io

View File

@@ -6,6 +6,7 @@ import (
"errors"
"fmt"
"github.com/ente-io/museum/ente/base"
"github.com/spf13/viper"
"github.com/ente-io/museum/ente"
"github.com/ente-io/stacktrace"
@@ -20,10 +21,12 @@ type FileLinkRepository struct {
}
// NewFileLinkRepo ..
func NewFileLinkRepo(db *sql.DB, albumHost string, lockerHost string) *FileLinkRepository {
func NewFileLinkRepo(db *sql.DB) *FileLinkRepository {
albumHost := viper.GetString("apps.public-albums")
if albumHost == "" {
albumHost = "https://albums.ente.io"
}
lockerHost := viper.GetString("apps.public-locker")
if lockerHost == "" {
lockerHost = "https://locker.ente.io"
}