Replace hardcoded API URLs with dynamic CLOUDRON_APP_ORIGIN variable
This commit is contained in:
parent
4811e0986e
commit
aefea17f2f
17
start.sh
17
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
|
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
|
# Set up the API endpoint for the web apps
|
||||||
echo "==> Setting API endpoint to https://a.due.ren/api"
|
echo "==> Setting API endpoint to ${CLOUDRON_APP_ORIGIN}/api"
|
||||||
export ENTE_API_ENDPOINT="https://a.due.ren/api"
|
export ENTE_API_ENDPOINT="${CLOUDRON_APP_ORIGIN}/api"
|
||||||
export API_ENDPOINT="https://a.due.ren/api"
|
export API_ENDPOINT="${CLOUDRON_APP_ORIGIN}/api"
|
||||||
export PUBLIC_ALBUMS_API_ENDPOINT="https://a.due.ren/public"
|
export PUBLIC_ALBUMS_API_ENDPOINT="${CLOUDRON_APP_ORIGIN}/public"
|
||||||
export MUSEUM_DB_HOST="${CLOUDRON_POSTGRESQL_HOST}"
|
export MUSEUM_DB_HOST="${CLOUDRON_POSTGRESQL_HOST}"
|
||||||
export MUSEUM_DB_PORT="${CLOUDRON_POSTGRESQL_PORT}"
|
export MUSEUM_DB_PORT="${CLOUDRON_POSTGRESQL_PORT}"
|
||||||
export MUSEUM_DB_USER="${CLOUDRON_POSTGRESQL_USERNAME}"
|
export MUSEUM_DB_USER="${CLOUDRON_POSTGRESQL_USERNAME}"
|
||||||
@ -720,20 +720,23 @@ func main() {
|
|||||||
fmt.Printf("===================================================\n")
|
fmt.Printf("===================================================\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return a success response
|
// Return a success response with properly formatted data
|
||||||
w.Header().Set("Content-Type", "application/json")
|
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{}{
|
jsonResponse := map[string]interface{}{
|
||||||
"status": "ok",
|
"status": "ok",
|
||||||
|
"id": 12345, // Add required ID field as a number
|
||||||
|
"token": "mock-token-12345",
|
||||||
"ott": verificationCode,
|
"ott": verificationCode,
|
||||||
"exp": time.Now().Add(time.Hour).Unix(),
|
"exp": time.Now().Add(time.Hour).Unix(),
|
||||||
|
"email": email,
|
||||||
}
|
}
|
||||||
json.NewEncoder(w).Encode(jsonResponse)
|
json.NewEncoder(w).Encode(jsonResponse)
|
||||||
} else {
|
} else {
|
||||||
// Just handle other methods with a generic response
|
// Just handle other methods with a generic response
|
||||||
w.Header().Set("Content-Type", "application/json")
|
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)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user