Commit aefea17f authored by Andreas Düren's avatar Andreas Düren
Browse files

Replace hardcoded API URLs with dynamic CLOUDRON_APP_ORIGIN variable

parent 4811e098
Loading
Loading
Loading
Loading
+10 −7
Original line number Diff line number Diff line
@@ -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)
        }
    })