Refactor port again
This commit is contained in:
@@ -320,7 +320,7 @@ Account settings are stored in `config.json`:
|
||||
**List accounts:**
|
||||
|
||||
```bash
|
||||
curl -u username:password http://localhost:8025/api/accounts
|
||||
curl -u username:password http://localhost:8825/api/accounts
|
||||
```
|
||||
|
||||
**Add account:**
|
||||
@@ -336,7 +336,7 @@ curl -u username:password \
|
||||
"session_path": "./sessions/new-account",
|
||||
"show_qr": true
|
||||
}' \
|
||||
http://localhost:8025/api/accounts/add
|
||||
http://localhost:8825/api/accounts/add
|
||||
```
|
||||
|
||||
**Update account:**
|
||||
@@ -355,7 +355,7 @@ curl -u username:password \
|
||||
"api_version": "v21.0"
|
||||
}
|
||||
}' \
|
||||
http://localhost:8025/api/accounts/update
|
||||
http://localhost:8825/api/accounts/update
|
||||
```
|
||||
|
||||
**Disable account:**
|
||||
@@ -365,7 +365,7 @@ curl -u username:password \
|
||||
-X POST \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"id": "my-account"}' \
|
||||
http://localhost:8025/api/accounts/disable
|
||||
http://localhost:8825/api/accounts/disable
|
||||
```
|
||||
|
||||
**Enable account:**
|
||||
@@ -375,7 +375,7 @@ curl -u username:password \
|
||||
-X POST \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"id": "my-account"}' \
|
||||
http://localhost:8025/api/accounts/enable
|
||||
http://localhost:8825/api/accounts/enable
|
||||
```
|
||||
|
||||
**Remove account:**
|
||||
@@ -385,7 +385,7 @@ curl -u username:password \
|
||||
-X POST \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"id": "my-account"}' \
|
||||
http://localhost:8025/api/accounts/remove
|
||||
http://localhost:8825/api/accounts/remove
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
24
CLI.md
24
CLI.md
@@ -52,7 +52,7 @@ Create a configuration file at `~/.whatshooked/cli.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
"server_url": "http://localhost:8025",
|
||||
"server_url": "http://localhost:8825",
|
||||
"auth_key": "your-api-key-here",
|
||||
"username": "",
|
||||
"password": ""
|
||||
@@ -63,7 +63,7 @@ Or use API key authentication:
|
||||
|
||||
```json
|
||||
{
|
||||
"server_url": "http://localhost:8025",
|
||||
"server_url": "http://localhost:8825",
|
||||
"auth_key": "your-secure-api-key"
|
||||
}
|
||||
```
|
||||
@@ -72,7 +72,7 @@ Or use username/password authentication:
|
||||
|
||||
```json
|
||||
{
|
||||
"server_url": "http://localhost:8025",
|
||||
"server_url": "http://localhost:8825",
|
||||
"username": "admin",
|
||||
"password": "your-secure-password"
|
||||
}
|
||||
@@ -90,14 +90,14 @@ cp .whatshooked-cli.example.json .whatshooked-cli.json
|
||||
Set environment variables (useful for CI/CD):
|
||||
|
||||
```bash
|
||||
export WHATSHOOKED_SERVER_URL="http://localhost:8025"
|
||||
export WHATSHOOKED_SERVER_URL="http://localhost:8825"
|
||||
export WHATSHOOKED_AUTH_KEY="your-api-key-here"
|
||||
```
|
||||
|
||||
Or with username/password:
|
||||
|
||||
```bash
|
||||
export WHATSHOOKED_SERVER_URL="http://localhost:8025"
|
||||
export WHATSHOOKED_SERVER_URL="http://localhost:8825"
|
||||
export WHATSHOOKED_USERNAME="admin"
|
||||
export WHATSHOOKED_PASSWORD="your-password"
|
||||
```
|
||||
@@ -107,7 +107,7 @@ export WHATSHOOKED_PASSWORD="your-password"
|
||||
Pass credentials via command-line flags:
|
||||
|
||||
```bash
|
||||
./bin/whatshook-cli --server http://localhost:8025 health
|
||||
./bin/whatshook-cli --server http://localhost:8825 health
|
||||
```
|
||||
|
||||
Note: Currently, authentication credentials can only be set via config file or environment variables. Command-line flags for auth credentials may be added in future versions.
|
||||
@@ -118,7 +118,7 @@ If your server doesn't require authentication, simply omit the authentication fi
|
||||
|
||||
```json
|
||||
{
|
||||
"server_url": "http://localhost:8025"
|
||||
"server_url": "http://localhost:8825"
|
||||
}
|
||||
```
|
||||
|
||||
@@ -136,7 +136,7 @@ The CLI looks for configuration files in the following locations (in order):
|
||||
|
||||
| Option | Type | Default | Description |
|
||||
| ------------ | ------ | ----------------------- | -------------------------- |
|
||||
| `server_url` | string | `http://localhost:8025` | WhatsHooked server URL |
|
||||
| `server_url` | string | `http://localhost:8825` | WhatsHooked server URL |
|
||||
| `auth_key` | string | `""` | API key for authentication |
|
||||
| `username` | string | `""` | Username for Basic Auth |
|
||||
| `password` | string | `""` | Password for Basic Auth |
|
||||
@@ -305,7 +305,7 @@ Supported formats: PDF, DOC, DOCX, XLS, XLSX, TXT, ZIP, and more
|
||||
mkdir -p ~/.whatshooked
|
||||
cat > ~/.whatshooked/cli.json <<EOF
|
||||
{
|
||||
"server_url": "http://localhost:8025",
|
||||
"server_url": "http://localhost:8825",
|
||||
"auth_key": "my-secure-api-key"
|
||||
}
|
||||
EOF
|
||||
@@ -321,7 +321,7 @@ EOF
|
||||
|
||||
```bash
|
||||
# Set environment variables
|
||||
export WHATSHOOKED_SERVER_URL="https://my-server.com:8025"
|
||||
export WHATSHOOKED_SERVER_URL="https://my-server.com:8825"
|
||||
export WHATSHOOKED_AUTH_KEY="production-api-key"
|
||||
|
||||
# Use CLI without config file
|
||||
@@ -381,7 +381,7 @@ export WHATSHOOKED_AUTH_KEY="production-api-key"
|
||||
{
|
||||
"server": {
|
||||
"host": "0.0.0.0",
|
||||
"port": 8025,
|
||||
"port": 8825,
|
||||
"auth_key": "super-secret-production-key"
|
||||
}
|
||||
}
|
||||
@@ -458,7 +458,7 @@ cp .whatshooked-cli.example.json ~/.whatshooked/cli.json
|
||||
Verify the server is running:
|
||||
|
||||
```bash
|
||||
curl http://localhost:8025/health
|
||||
curl http://localhost:8825/health
|
||||
```
|
||||
|
||||
### Authentication Required
|
||||
|
||||
30
DOCKER.md
30
DOCKER.md
@@ -43,7 +43,7 @@ This guide explains how to run WhatsHooked using Docker and Docker Compose.
|
||||
|
||||
6. **Check server health:**
|
||||
```bash
|
||||
curl http://localhost:8025/health
|
||||
curl http://localhost:8825/health
|
||||
```
|
||||
|
||||
## Docker Commands
|
||||
@@ -98,7 +98,7 @@ These volumes ensure your data persists across container restarts.
|
||||
|
||||
### Port Mapping
|
||||
|
||||
By default, the server runs on port 8025. To change the port:
|
||||
By default, the server runs on port 8825. To change the port:
|
||||
|
||||
**Option 1: Update config.json**
|
||||
|
||||
@@ -121,7 +121,7 @@ ports:
|
||||
|
||||
```yaml
|
||||
ports:
|
||||
- "3000:8025" # Access via localhost:3000, server still runs on 8025 internally
|
||||
- "3000:8825" # Access via localhost:3000, server still runs on 8825 internally
|
||||
```
|
||||
|
||||
### Authentication
|
||||
@@ -185,7 +185,7 @@ The QR code will be displayed in ASCII art in the terminal along with a browser
|
||||
|
||||
**Option 2: View in Browser**
|
||||
|
||||
1. Look for the line: `Or open in browser: http://localhost:8025/api/qr/{account_id}`
|
||||
1. Look for the line: `Or open in browser: http://localhost:8825/api/qr/{account_id}`
|
||||
2. Open that URL in your web browser to see a larger PNG image
|
||||
3. Scan the QR code from your browser
|
||||
|
||||
@@ -206,37 +206,37 @@ The Docker image includes both the server and CLI binaries in the `/app/bin` dir
|
||||
List all hooks:
|
||||
|
||||
```bash
|
||||
docker exec whatshooked-server /app/bin/whatshook-cli --server http://localhost:8025 hooks list
|
||||
docker exec whatshooked-server /app/bin/whatshook-cli --server http://localhost:8825 hooks list
|
||||
```
|
||||
|
||||
Add a new hook:
|
||||
|
||||
```bash
|
||||
docker exec -it whatshooked-server /app/bin/whatshook-cli --server http://localhost:8025 hooks add
|
||||
docker exec -it whatshooked-server /app/bin/whatshook-cli --server http://localhost:8825 hooks add
|
||||
```
|
||||
|
||||
Remove a hook:
|
||||
|
||||
```bash
|
||||
docker exec whatshooked-server /app/bin/whatshook-cli --server http://localhost:8025 hooks remove <hook_id>
|
||||
docker exec whatshooked-server /app/bin/whatshook-cli --server http://localhost:8825 hooks remove <hook_id>
|
||||
```
|
||||
|
||||
List WhatsApp accounts:
|
||||
|
||||
```bash
|
||||
docker exec whatshooked-server /app/bin/whatshook-cli --server http://localhost:8025 accounts list
|
||||
docker exec whatshooked-server /app/bin/whatshook-cli --server http://localhost:8825 accounts list
|
||||
```
|
||||
|
||||
Send a message:
|
||||
|
||||
```bash
|
||||
docker exec -it whatshooked-server /app/bin/whatshook-cli --server http://localhost:8025 send
|
||||
docker exec -it whatshooked-server /app/bin/whatshook-cli --server http://localhost:8825 send
|
||||
```
|
||||
|
||||
Check server health:
|
||||
|
||||
```bash
|
||||
docker exec whatshooked-server /app/bin/whatshook-cli --server http://localhost:8025 health
|
||||
docker exec whatshooked-server /app/bin/whatshook-cli --server http://localhost:8825 health
|
||||
```
|
||||
|
||||
### Authentication with CLI
|
||||
@@ -247,7 +247,7 @@ If your server has authentication enabled, you need to configure it in the CLI:
|
||||
|
||||
```bash
|
||||
docker exec whatshooked-server /app/bin/whatshook-cli \
|
||||
--server http://localhost:8025 \
|
||||
--server http://localhost:8825 \
|
||||
--api-key your-api-key \
|
||||
hooks list
|
||||
```
|
||||
@@ -265,7 +265,7 @@ docker exec whatshooked-server /app/bin/whatshook-cli \
|
||||
```bash
|
||||
cat > /app/.whatshooked-cli.json <<EOF
|
||||
{
|
||||
"server_url": "http://localhost:8025",
|
||||
"server_url": "http://localhost:8825",
|
||||
"api_key": "your-api-key"
|
||||
}
|
||||
EOF
|
||||
@@ -281,7 +281,7 @@ docker exec whatshooked-server /app/bin/whatshook-cli \
|
||||
Create an alias on your host machine for easier CLI access:
|
||||
|
||||
```bash
|
||||
alias whatshook-cli='docker exec -it whatshooked-server /app/bin/whatshook-cli --server http://localhost:8025'
|
||||
alias whatshook-cli='docker exec -it whatshooked-server /app/bin/whatshook-cli --server http://localhost:8825'
|
||||
```
|
||||
|
||||
Then use it like:
|
||||
@@ -388,7 +388,7 @@ services:
|
||||
- whatshooked-net
|
||||
# Don't expose ports to host, only to network
|
||||
# ports:
|
||||
# - "8025:8025"
|
||||
# - "8825:8825"
|
||||
|
||||
networks:
|
||||
whatshooked-net:
|
||||
@@ -406,7 +406,7 @@ server {
|
||||
ssl_certificate_key /path/to/key.pem;
|
||||
|
||||
location / {
|
||||
proxy_pass http://whatshooked:8025;
|
||||
proxy_pass http://whatshooked:8825;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ COPY --from=builder /build/bin ./bin
|
||||
RUN mkdir -p /app/sessions /app/data/media /app/data/certs
|
||||
|
||||
# Expose the default server port
|
||||
EXPOSE 8025
|
||||
EXPOSE 8825
|
||||
|
||||
# Run the server
|
||||
ENTRYPOINT ["/app/bin/whatshook-server"]
|
||||
|
||||
@@ -270,7 +270,7 @@ script:
|
||||
{
|
||||
"server": {
|
||||
"host": "0.0.0.0",
|
||||
"port": 8025
|
||||
"port": 8825
|
||||
},
|
||||
"whatsapp": [
|
||||
{
|
||||
|
||||
40
README.md
40
README.md
@@ -60,7 +60,7 @@ Or with programmatic configuration:
|
||||
|
||||
```go
|
||||
wh, err := whatshooked.New(
|
||||
whatshooked.WithServer("0.0.0.0", 8025),
|
||||
whatshooked.WithServer("0.0.0.0", 8825),
|
||||
whatshooked.WithAuth("my-api-key", "", ""),
|
||||
whatshooked.WithWhatsmeowAccount("personal", "+1234567890", "./session", true),
|
||||
)
|
||||
@@ -92,7 +92,7 @@ Scan this QR code with WhatsApp on your phone:
|
||||
|
||||
[ASCII QR Code displayed here]
|
||||
|
||||
Or open in browser: http://localhost:8025/api/qr/personal
|
||||
Or open in browser: http://localhost:8825/api/qr/personal
|
||||
========================================
|
||||
```
|
||||
|
||||
@@ -100,7 +100,7 @@ Or open in browser: http://localhost:8025/api/qr/personal
|
||||
|
||||
For easier scanning, open the provided URL in your browser to view a larger PNG image:
|
||||
|
||||
- URL format: `http://localhost:8025/api/qr/{account_id}`
|
||||
- URL format: `http://localhost:8825/api/qr/{account_id}`
|
||||
- No authentication required for this endpoint
|
||||
- The QR code updates automatically when a new code is generated
|
||||
|
||||
@@ -114,7 +114,7 @@ The QR code URL is also included in the `whatsapp.qr.code` event:
|
||||
"data": {
|
||||
"account_id": "personal",
|
||||
"qr_code": "2@...",
|
||||
"qr_url": "http://localhost:8025/api/qr/personal"
|
||||
"qr_url": "http://localhost:8825/api/qr/personal"
|
||||
}
|
||||
}
|
||||
```
|
||||
@@ -210,7 +210,7 @@ func main() {
|
||||
// Your own handlers
|
||||
mux.HandleFunc("/api/v1/custom", yourCustomHandler)
|
||||
|
||||
http.ListenAndServe(":8025", mux)
|
||||
http.ListenAndServe(":8825", mux)
|
||||
}
|
||||
```
|
||||
|
||||
@@ -220,7 +220,7 @@ Configure WhatsHooked entirely in code without a config file:
|
||||
|
||||
```go
|
||||
wh, err := whatshooked.New(
|
||||
whatshooked.WithServer("0.0.0.0", 8025),
|
||||
whatshooked.WithServer("0.0.0.0", 8825),
|
||||
whatshooked.WithAuth("my-api-key", "", ""),
|
||||
whatshooked.WithWhatsmeowAccount(
|
||||
"personal",
|
||||
@@ -389,7 +389,7 @@ Edit the configuration file to add your WhatsApp accounts and webhooks:
|
||||
{
|
||||
"server": {
|
||||
"host": "localhost",
|
||||
"port": 8025,
|
||||
"port": 8825,
|
||||
"default_country_code": "27"
|
||||
},
|
||||
"whatsapp": [
|
||||
@@ -435,7 +435,7 @@ Edit the configuration file to add your WhatsApp accounts and webhooks:
|
||||
**Server Configuration:**
|
||||
|
||||
- `host`: Server hostname (default: "localhost")
|
||||
- `port`: Server port (default: 8025)
|
||||
- `port`: Server port (default: 8825)
|
||||
- `default_country_code`: Default country code for phone number formatting (e.g., "27" for South Africa, "1" for US/Canada)
|
||||
- `username`: Username for HTTP Basic Authentication (optional)
|
||||
- `password`: Password for HTTP Basic Authentication (optional)
|
||||
@@ -637,7 +637,7 @@ To disable HTTPS and use HTTP, set `enabled: false` or omit the `tls` section en
|
||||
{
|
||||
"server": {
|
||||
"host": "localhost",
|
||||
"port": 8025
|
||||
"port": 8825
|
||||
}
|
||||
}
|
||||
```
|
||||
@@ -654,7 +654,7 @@ Set both `username` and `password` in the server configuration:
|
||||
{
|
||||
"server": {
|
||||
"host": "localhost",
|
||||
"port": 8025,
|
||||
"port": 8825,
|
||||
"username": "admin",
|
||||
"password": "secure_password"
|
||||
}
|
||||
@@ -664,7 +664,7 @@ Set both `username` and `password` in the server configuration:
|
||||
Clients must provide credentials in the Authorization header:
|
||||
|
||||
```bash
|
||||
curl -u admin:secure_password http://localhost:8025/api/hooks
|
||||
curl -u admin:secure_password http://localhost:8825/api/hooks
|
||||
```
|
||||
|
||||
#### 2. API Key Authentication
|
||||
@@ -675,7 +675,7 @@ Set `auth_key` in the server configuration:
|
||||
{
|
||||
"server": {
|
||||
"host": "localhost",
|
||||
"port": 8025,
|
||||
"port": 8825,
|
||||
"auth_key": "your-secret-api-key"
|
||||
}
|
||||
}
|
||||
@@ -685,11 +685,11 @@ Clients can provide the API key using either:
|
||||
|
||||
- **x-api-key header**:
|
||||
```bash
|
||||
curl -H "x-api-key: your-secret-api-key" http://localhost:8025/api/hooks
|
||||
curl -H "x-api-key: your-secret-api-key" http://localhost:8825/api/hooks
|
||||
```
|
||||
- **Authorization Bearer token**:
|
||||
```bash
|
||||
curl -H "Authorization: Bearer your-secret-api-key" http://localhost:8025/api/hooks
|
||||
curl -H "Authorization: Bearer your-secret-api-key" http://localhost:8825/api/hooks
|
||||
```
|
||||
|
||||
#### Authentication Notes
|
||||
@@ -755,7 +755,7 @@ To receive incoming messages from WhatsApp Business API, you must register your
|
||||
1. **Start the WhatsHooked server** with your Business API configuration
|
||||
2. **Ensure your server is publicly accessible** (use ngrok for testing):
|
||||
```bash
|
||||
ngrok http 8025
|
||||
ngrok http 8825
|
||||
```
|
||||
3. **In Meta for Developers**, go to **WhatsApp** → **Configuration**
|
||||
4. **Add Webhook URL**:
|
||||
@@ -895,13 +895,13 @@ cp .whatshooked-cli.example.json .whatshooked-cli.json
|
||||
Or set via environment variable:
|
||||
|
||||
```bash
|
||||
export WHATSHOOKED_SERVER_URL=http://localhost:8025
|
||||
export WHATSHOOKED_SERVER_URL=http://localhost:8825
|
||||
```
|
||||
|
||||
Or use command-line flag:
|
||||
|
||||
```bash
|
||||
./bin/whatshook-cli --server http://localhost:8025 health
|
||||
./bin/whatshook-cli --server http://localhost:8825 health
|
||||
```
|
||||
|
||||
#### Commands
|
||||
@@ -963,10 +963,10 @@ Send a message:
|
||||
|
||||
The CLI loads configuration with the following priority (highest to lowest):
|
||||
|
||||
1. **Command-line flags**: `--server http://example.com:8025`
|
||||
2. **Environment variables**: `WHATSHOOKED_SERVER_URL=http://example.com:8025`
|
||||
1. **Command-line flags**: `--server http://example.com:8825`
|
||||
2. **Environment variables**: `WHATSHOOKED_SERVER_URL=http://example.com:8825`
|
||||
3. **Config file**: `.whatshooked-cli.json` in current directory or `$HOME/.whatshooked/cli.json`
|
||||
4. **Defaults**: `http://localhost:8025`
|
||||
4. **Defaults**: `http://localhost:8825`
|
||||
|
||||
## Webhook Integration
|
||||
|
||||
|
||||
@@ -574,40 +574,40 @@ Events are automatically cached when:
|
||||
**List cached events:**
|
||||
|
||||
```bash
|
||||
curl -u username:password http://localhost:8025/api/cache
|
||||
curl -u username:password http://localhost:8825/api/cache
|
||||
```
|
||||
|
||||
**Get cache statistics:**
|
||||
|
||||
```bash
|
||||
curl -u username:password http://localhost:8025/api/cache/stats
|
||||
curl -u username:password http://localhost:8825/api/cache/stats
|
||||
```
|
||||
|
||||
**Replay all cached events:**
|
||||
|
||||
```bash
|
||||
curl -X POST -u username:password http://localhost:8025/api/cache/replay
|
||||
curl -X POST -u username:password http://localhost:8825/api/cache/replay
|
||||
```
|
||||
|
||||
**Replay specific event:**
|
||||
|
||||
```bash
|
||||
curl -X POST -u username:password \
|
||||
"http://localhost:8025/api/cache/event/replay?id=EVENT_ID"
|
||||
"http://localhost:8825/api/cache/event/replay?id=EVENT_ID"
|
||||
```
|
||||
|
||||
**Delete cached event:**
|
||||
|
||||
```bash
|
||||
curl -X DELETE -u username:password \
|
||||
"http://localhost:8025/api/cache/event/delete?id=EVENT_ID"
|
||||
"http://localhost:8825/api/cache/event/delete?id=EVENT_ID"
|
||||
```
|
||||
|
||||
**Clear all cache:**
|
||||
|
||||
```bash
|
||||
curl -X DELETE -u username:password \
|
||||
"http://localhost:8025/api/cache/clear?confirm=true"
|
||||
"http://localhost:8825/api/cache/clear?confirm=true"
|
||||
```
|
||||
|
||||
### Cache Workflow Example
|
||||
@@ -662,7 +662,7 @@ curl -X DELETE -u username:password \
|
||||
|
||||
1. `message_cache.enabled` is `true` in config
|
||||
2. Hooks are actually inactive or not matching events
|
||||
3. Check cache stats: `curl -u user:pass http://localhost:8025/api/cache/stats`
|
||||
3. Check cache stats: `curl -u user:pass http://localhost:8825/api/cache/stats`
|
||||
|
||||
### No Hooks Configured Error
|
||||
|
||||
@@ -715,7 +715,7 @@ Enable debug logging to trace the issue:
|
||||
"type": "image",
|
||||
"mime_type": "image/jpeg",
|
||||
"filename": "wamid.xxx_a1b2c3d4.jpg",
|
||||
"url": "http://localhost:8025/api/media/business/wamid.xxx_a1b2c3d4.jpg",
|
||||
"url": "http://localhost:8825/api/media/business/wamid.xxx_a1b2c3d4.jpg",
|
||||
"base64": "..." // Only if media.mode is "base64" or "both"
|
||||
}
|
||||
}
|
||||
@@ -776,7 +776,7 @@ Here's a complete `config.json` with all Business API features:
|
||||
{
|
||||
"server": {
|
||||
"host": "0.0.0.0",
|
||||
"port": 8025,
|
||||
"port": 8825,
|
||||
"default_country_code": "1",
|
||||
"username": "admin",
|
||||
"password": "secure_password",
|
||||
|
||||
@@ -20,7 +20,7 @@ func LoadCLIConfig(configFile string, serverFlag string) (*CLIConfig, error) {
|
||||
v := viper.New()
|
||||
|
||||
// Set defaults
|
||||
v.SetDefault("server_url", "http://localhost:8025")
|
||||
v.SetDefault("server_url", "http://localhost:8825")
|
||||
v.SetDefault("auth_key", "")
|
||||
v.SetDefault("username", "")
|
||||
v.SetDefault("password", "")
|
||||
|
||||
@@ -36,7 +36,7 @@ var rootCmd = &cobra.Command{
|
||||
|
||||
func init() {
|
||||
rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default: $HOME/.whatshooked/cli.json)")
|
||||
rootCmd.PersistentFlags().StringVar(&serverURL, "server", "", "server URL (default: http://localhost:8025)")
|
||||
rootCmd.PersistentFlags().StringVar(&serverURL, "server", "", "server URL (default: http://localhost:8825)")
|
||||
|
||||
// Add all command groups
|
||||
rootCmd.AddCommand(healthCmd)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"server_url": "http://localhost:8025",
|
||||
"server_url": "http://localhost:8825",
|
||||
"auth_key": "",
|
||||
"username": "",
|
||||
"password": ""
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"server": {
|
||||
"host": "localhost",
|
||||
"port": 8025,
|
||||
"port": 8825,
|
||||
"default_country_code": "27",
|
||||
"username": "",
|
||||
"password": "",
|
||||
@@ -97,7 +97,7 @@
|
||||
"media": {
|
||||
"data_path": "./data/media",
|
||||
"mode": "link",
|
||||
"base_url": "http://localhost:8025"
|
||||
"base_url": "http://localhost:8825"
|
||||
},
|
||||
"database": {
|
||||
"type": "postgres",
|
||||
|
||||
@@ -7,7 +7,7 @@ services:
|
||||
dockerfile: Dockerfile
|
||||
container_name: whatshooked-server
|
||||
ports:
|
||||
- "0.0.0.0:8025:8025"
|
||||
- "0.0.0.0:8825:8825"
|
||||
volumes:
|
||||
# Mount config file
|
||||
- type: bind
|
||||
@@ -25,7 +25,7 @@ services:
|
||||
|
||||
# Health check
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:8025/health"]
|
||||
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:8825/health"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
|
||||
@@ -152,7 +152,7 @@ func Load(path string) (*Config, error) {
|
||||
cfg.Server.Host = "0.0.0.0"
|
||||
}
|
||||
if cfg.Server.Port == 0 {
|
||||
cfg.Server.Port = 8025
|
||||
cfg.Server.Port = 8825
|
||||
}
|
||||
if cfg.Media.DataPath == "" {
|
||||
cfg.Media.DataPath = "./data/media"
|
||||
|
||||
@@ -432,7 +432,7 @@ func (c *Client) saveMediaFile(messageID string, data []byte, mimeType string) (
|
||||
func (c *Client) generateMediaURL(messageID, filename string) string {
|
||||
baseURL := c.mediaConfig.BaseURL
|
||||
if baseURL == "" {
|
||||
baseURL = "http://localhost:8025"
|
||||
baseURL = "http://localhost:8825"
|
||||
}
|
||||
return fmt.Sprintf("%s/api/media/%s/%s", baseURL, c.id, filename)
|
||||
}
|
||||
|
||||
@@ -678,7 +678,7 @@ func (c *Client) saveMediaFile(messageID string, data []byte, mimeType string) (
|
||||
func (c *Client) generateMediaURL(messageID, filename string) string {
|
||||
baseURL := c.mediaConfig.BaseURL
|
||||
if baseURL == "" {
|
||||
baseURL = "http://localhost:8025"
|
||||
baseURL = "http://localhost:8825"
|
||||
}
|
||||
return fmt.Sprintf("%s/api/media/%s/%s", baseURL, c.id, filename)
|
||||
}
|
||||
@@ -737,7 +737,7 @@ func getExtensionFromMimeType(mimeType string) string {
|
||||
func (c *Client) generateQRCodeURL() string {
|
||||
baseURL := c.mediaConfig.BaseURL
|
||||
if baseURL == "" {
|
||||
baseURL = "http://localhost:8025"
|
||||
baseURL = "http://localhost:8825"
|
||||
}
|
||||
return fmt.Sprintf("%s/api/qr/%s", baseURL, c.id)
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ func New(opts ...Option) (*WhatsHooked, error) {
|
||||
cfg := &config.Config{
|
||||
Server: config.ServerConfig{
|
||||
Host: "0.0.0.0",
|
||||
Port: 8025,
|
||||
Port: 8825,
|
||||
},
|
||||
Media: config.MediaConfig{
|
||||
DataPath: "./data/media",
|
||||
|
||||
Reference in New Issue
Block a user