The application can be configured using the following environment variables:
Variable | Description | Default Value |
---|---|---|
NETHVOICE_MIDDLEWARE_LISTEN_ADDRESS |
Address and port where the middleware will listen | 127.0.0.1:8080 |
NETHVOICE_MIDDLEWARE_SECRET_JWT |
Secret key used for JWT token signing and validation | Auto-generated UUID |
NETHVOICE_MIDDLEWARE_V1_PROTOCOL |
Protocol used for V1 API connections | https |
NETHVOICE_MIDDLEWARE_V1_API_ENDPOINT |
Hostname/IP for V1 API endpoint | cti2.demo-heron.sf.nethserver.net |
NETHVOICE_MIDDLEWARE_V1_WS_ENDPOINT |
Hostname/IP for V1 WebSocket endpoint | cti2.demo-heron.sf.nethserver.net |
NETHVOICE_MIDDLEWARE_V1_API_PATH |
Path prefix for V1 API calls | (empty) |
NETHVOICE_MIDDLEWARE_V1_WS_PATH |
Path for V1 WebSocket connections | /socket.io |
NETHVOICE_MIDDLEWARE_SENSITIVE_LIST |
Comma-separated list of sensitive field names for logging | password,secret,token,passphrase,private,key |
NETHVOICE_MIDDLEWARE_SECRETS_DIR |
Directory path for storing secrets | Required |
ISSUER_2FA |
Issuer name for 2FA tokens | NethVoice |
- Go 1.24 or later
oathtool
package (for 2FA testing)
Install oathtool on Ubuntu/Debian:
sudo apt-get install oathtool
Run all tests:
go test ./...
Run tests with verbose output:
go test -v ./...
Tests automatically create a temporary test environment with:
- Mock NetCTI server for authentication testing
- Temporary secrets directory (
/tmp/test-secrets
) - Test JWT secret key
- Clean state for each test
The test suite covers:
- Authentication and login flows
- 2FA setup, verification, and management
- JWT token handling
- Recovery codes functionality
- Error handling and edge cases
Stop the existing container and clean up system resources:
podman stop nethcti-container
podman system prune --all --volumes --force
Build the Docker image:
podman build -t nethcti-middleware .
Run the container with environment configuration:
podman run -d -p 8080:8080 --name nethcti-container \
--env NETHVOICE_MIDDLEWARE_LISTEN_ADDRESS=:8080 \
--env NETHVOICE_MIDDLEWARE_SECRET_JWT=test \
--env NETHVOICE_MIDDLEWARE_SECRETS_DIR=/var/log/nethcti \
--env NETHVOICE_MIDDLEWARE_V1_API_PATH=/webrest \
--volume ./data:/var/log/nethcti \
--replace nethcti-middleware