From aefea17f2f321ed34cae102bcb0f060536efd84a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20D=C3=BCren?= Date: Tue, 18 Mar 2025 20:29:45 +0100 Subject: [PATCH] Replace hardcoded API URLs with dynamic CLOUDRON_APP_ORIGIN variable --- start.sh | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/start.sh b/start.sh index 6e3e717..da51238 100644 --- a/start.sh +++ b/start.sh @@ -217,10 +217,10 @@ sed -i 's|storage.type: "local"|storage.type: "s3"|g' /app/data/config/config.ya sed -i 's|s3.are_local_buckets: true|s3.are_local_buckets: false|g' /app/data/config/config.yaml # Set up the API endpoint for the web apps -echo "==> Setting API endpoint to https://a.due.ren/api" -export ENTE_API_ENDPOINT="https://a.due.ren/api" -export API_ENDPOINT="https://a.due.ren/api" -export PUBLIC_ALBUMS_API_ENDPOINT="https://a.due.ren/public" +echo "==> Setting API endpoint to ${CLOUDRON_APP_ORIGIN}/api" +export ENTE_API_ENDPOINT="${CLOUDRON_APP_ORIGIN}/api" +export API_ENDPOINT="${CLOUDRON_APP_ORIGIN}/api" +export PUBLIC_ALBUMS_API_ENDPOINT="${CLOUDRON_APP_ORIGIN}/public" export MUSEUM_DB_HOST="${CLOUDRON_POSTGRESQL_HOST}" export MUSEUM_DB_PORT="${CLOUDRON_POSTGRESQL_PORT}" export MUSEUM_DB_USER="${CLOUDRON_POSTGRESQL_USERNAME}" @@ -720,20 +720,23 @@ func main() { fmt.Printf("===================================================\n") } - // Return a success response + // Return a success response with properly formatted data w.Header().Set("Content-Type", "application/json") - // Use the encoding/json package to create and send the response + // Create a response with the required fields jsonResponse := map[string]interface{}{ "status": "ok", + "id": 12345, // Add required ID field as a number + "token": "mock-token-12345", "ott": verificationCode, "exp": time.Now().Add(time.Hour).Unix(), + "email": email, } json.NewEncoder(w).Encode(jsonResponse) } else { // Just handle other methods with a generic response w.Header().Set("Content-Type", "application/json") - fmt.Fprintf(w, \`{"status":"mock","endpoint":"%s","method":"%s"}\`, r.URL.Path, r.Method) + fmt.Fprintf(w, `{"status":"mock","endpoint":"%s","method":"%s"}`, r.URL.Path, r.Method) } })