Completely remove PHOTOVIEW_PUBLIC_ENDPOINT
This commit is contained in:
parent
2c98827db5
commit
430869b319
|
@ -22,8 +22,6 @@ PHOTOVIEW_UI_ENDPOINT=http://localhost:1234/
|
|||
|
||||
# Set to 1 for the server to also serve the built static ui files
|
||||
PHOTOVIEW_SERVE_UI=0
|
||||
# When PHOTOVIEW_SERVE_UI is 1, PHOTOVIEW_PUBLIC_ENDPOINT is used instead of PHOTOVIEW_API_ENDPOINT and PHOTOVIEW_UI_ENDPOINT
|
||||
#PHOTOVIEW_PUBLIC_ENDPOINT=http://localhost:4001/
|
||||
|
||||
# Enter a valid mapbox token, to enable maps feature
|
||||
# A token can be created for free at https://mapbox.com
|
||||
|
|
|
@ -117,6 +117,8 @@ func main() {
|
|||
|
||||
if uiEndpoint := utils.UiEndpointUrl(); uiEndpoint != nil {
|
||||
log.Printf("Photoview UI public endpoint ready at %s\n", uiEndpoint.String())
|
||||
} else {
|
||||
log.Println("Photoview UI public endpoint ready at /")
|
||||
}
|
||||
|
||||
if !shouldServeUI {
|
||||
|
|
|
@ -45,43 +45,37 @@ func ApiListenUrl() *url.URL {
|
|||
}
|
||||
|
||||
func ApiEndpointUrl() *url.URL {
|
||||
apiEndpointStr := EnvAPIEndpoint.GetValue()
|
||||
var apiEndpointStr string
|
||||
|
||||
shouldServeUI := ShouldServeUI()
|
||||
if shouldServeUI {
|
||||
apiEndpointStr = EnvPublicEndpoint.GetValue()
|
||||
if apiEndpointStr == "" {
|
||||
apiEndpointStr = "/"
|
||||
}
|
||||
} else {
|
||||
apiEndpointStr = EnvAPIEndpoint.GetValue()
|
||||
}
|
||||
|
||||
apiEndpointUrl, err := url.Parse(apiEndpointStr)
|
||||
apiEndpointURL, err := url.Parse(apiEndpointStr)
|
||||
if err != nil {
|
||||
log.Fatalf("ERROR: Environment variable %s is not a proper url (%s)", EnvAPIEndpoint.GetName(), EnvAPIEndpoint.GetValue())
|
||||
}
|
||||
|
||||
if shouldServeUI {
|
||||
apiEndpointUrl.Path = path.Join(apiEndpointUrl.Path, "/api")
|
||||
apiEndpointURL.Path = path.Join(apiEndpointURL.Path, "/api")
|
||||
}
|
||||
|
||||
return apiEndpointUrl
|
||||
return apiEndpointURL
|
||||
}
|
||||
|
||||
func UiEndpointUrl() *url.URL {
|
||||
uiEndpointStr := EnvUIEndpoint.GetValue()
|
||||
|
||||
shouldServeUI := ShouldServeUI()
|
||||
if shouldServeUI {
|
||||
uiEndpointStr = EnvPublicEndpoint.GetValue()
|
||||
if uiEndpointStr == "" {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
uiEndpointUrl, err := url.Parse(uiEndpointStr)
|
||||
uiEndpointURL, err := url.Parse(EnvUIEndpoint.GetValue())
|
||||
if err != nil {
|
||||
log.Fatalf("ERROR: Environment variable %s is not a proper url (%s)", EnvUIEndpoint.GetName(), EnvUIEndpoint.GetValue())
|
||||
}
|
||||
|
||||
return uiEndpointUrl
|
||||
return uiEndpointURL
|
||||
}
|
||||
|
|
|
@ -19,7 +19,6 @@ const (
|
|||
EnvListenPort EnvironmentVariable = "PHOTOVIEW_LISTEN_PORT"
|
||||
EnvAPIEndpoint EnvironmentVariable = "PHOTOVIEW_API_ENDPOINT"
|
||||
EnvUIEndpoint EnvironmentVariable = "PHOTOVIEW_UI_ENDPOINT"
|
||||
EnvPublicEndpoint EnvironmentVariable = "PHOTOVIEW_PUBLIC_ENDPOINT"
|
||||
)
|
||||
|
||||
// Database related
|
||||
|
|
|
@ -27,11 +27,6 @@ services:
|
|||
- PHOTOVIEW_LISTEN_PORT=80
|
||||
- PHOTOVIEW_MEDIA_CACHE=/app/cache
|
||||
|
||||
# Change This: The publicly exposed url
|
||||
# For example if the server is available from the domain example.com,
|
||||
# change this value to http://example.com/
|
||||
- PHOTOVIEW_PUBLIC_ENDPOINT=http://localhost:8000/
|
||||
|
||||
# Optional: To enable map related features, you need to create a mapbox token.
|
||||
# A token can be generated for free here https://account.mapbox.com/access-tokens/
|
||||
# It's a good idea to limit the scope of the token to your own domain, to prevent others from using it.
|
||||
|
@ -40,7 +35,7 @@ services:
|
|||
volumes:
|
||||
- api_cache:/app/cache
|
||||
|
||||
# Change this to the directory where your photos are located on your server.
|
||||
# Change This: to the directory where your photos are located on your server.
|
||||
# If the photos are located at `/home/user/photos`, then change this value
|
||||
# to the following: `/home/user/photos:/photos:ro`.
|
||||
# You can mount multiple paths, if your photos are spread across multiple directories.
|
||||
|
|
Loading…
Reference in New Issue