mirror of
https://github.com/Dvorinka/PPve.git
synced 2026-06-03 20:12:59 +00:00
Add files via upload
This commit is contained in:
@@ -7,7 +7,7 @@ BINARY_NAME=contact-scrape
|
|||||||
KONTAKT_BINARY=kontakt-service
|
KONTAKT_BINARY=kontakt-service
|
||||||
BUILD_DIR=build
|
BUILD_DIR=build
|
||||||
PORT=80
|
PORT=80
|
||||||
KONTAKT_PORT=8081
|
KONTAKT_PORT=8080
|
||||||
|
|
||||||
help: ## Show this help message
|
help: ## Show this help message
|
||||||
@echo "Available commands:"
|
@echo "Available commands:"
|
||||||
@@ -120,7 +120,7 @@ monitor: ## Monitor the service with file watching
|
|||||||
@while true; do \
|
@while true; do \
|
||||||
inotifywait -e modify contacts.xlsx 2>/dev/null && \
|
inotifywait -e modify contacts.xlsx 2>/dev/null && \
|
||||||
echo "File changed, reloading..." && \
|
echo "File changed, reloading..." && \
|
||||||
curl -X POST http://localhost:$(PORT)/kontakt/reload; \
|
curl -X POST http://webportal:$(PORT)/kontakt/reload; \
|
||||||
sleep 1; \
|
sleep 1; \
|
||||||
done
|
done
|
||||||
|
|
||||||
@@ -163,6 +163,6 @@ info: ## Show application information
|
|||||||
@echo "Build dir: $(BUILD_DIR)"
|
@echo "Build dir: $(BUILD_DIR)"
|
||||||
@echo ""
|
@echo ""
|
||||||
@echo "Endpoints:"
|
@echo "Endpoints:"
|
||||||
@echo " http://localhost:$(PORT)/kontakt - Web interface"
|
@echo " http://webportal:$(PORT)/kontakt - Web interface"
|
||||||
@echo " http://localhost:$(PORT)/kontakt/contacts - JSON API"
|
@echo " http://webportal:$(PORT)/kontakt/contacts - JSON API"
|
||||||
@echo " http://localhost:$(PORT)/kontakt/reload - Reload data (POST)"
|
@echo " http://webportal:$(PORT)/kontakt/reload - Reload data (POST)"
|
||||||
@@ -40,7 +40,7 @@ func main() {
|
|||||||
log.SetFlags(log.LstdFlags | log.Lshortfile)
|
log.SetFlags(log.LstdFlags | log.Lshortfile)
|
||||||
|
|
||||||
// Set up reverse proxy to kontakt service
|
// Set up reverse proxy to kontakt service
|
||||||
kontaktURL, _ := url.Parse("http://localhost:8081")
|
kontaktURL, _ := url.Parse("http://webportal:8080")
|
||||||
kontaktProxy := httputil.NewSingleHostReverseProxy(kontaktURL)
|
kontaktProxy := httputil.NewSingleHostReverseProxy(kontaktURL)
|
||||||
|
|
||||||
http.Handle("/kontakt/", http.StripPrefix("/kontakt", kontaktProxy))
|
http.Handle("/kontakt/", http.StripPrefix("/kontakt", kontaktProxy))
|
||||||
@@ -61,9 +61,9 @@ func main() {
|
|||||||
|
|
||||||
http.HandleFunc("/kontakt", enableCORS(func(w http.ResponseWriter, r *http.Request) {
|
http.HandleFunc("/kontakt", enableCORS(func(w http.ResponseWriter, r *http.Request) {
|
||||||
// Check if kontakt service is already running
|
// Check if kontakt service is already running
|
||||||
resp, err := http.Get("http://localhost:8081/health")
|
resp, err := http.Get("http://webportal:8080/health")
|
||||||
if err == nil && resp.StatusCode == 200 {
|
if err == nil && resp.StatusCode == 200 {
|
||||||
http.Redirect(w, r, "http://localhost:8081/", http.StatusFound)
|
http.Redirect(w, r, "http://webportal:8080/", http.StatusFound)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,7 +78,7 @@ func main() {
|
|||||||
|
|
||||||
// Wait briefly for service to start
|
// Wait briefly for service to start
|
||||||
time.Sleep(2 * time.Second)
|
time.Sleep(2 * time.Second)
|
||||||
http.Redirect(w, r, "http://localhost:8081/", http.StatusFound)
|
http.Redirect(w, r, "http://webportal:8080/", http.StatusFound)
|
||||||
}))
|
}))
|
||||||
|
|
||||||
port := os.Getenv("PORT")
|
port := os.Getenv("PORT")
|
||||||
|
|||||||
Reference in New Issue
Block a user