waveemapi3 is yet another WAV-to-MP3 API, but at least it's not an FFmpeg wrapper. (I wish it was at this point 😭😭).
This service is intended for internal API-to-API communication with simple API authentication. It only really exists because LAME is licensed with the LGPL license.
git clone https://github.com/wsand02/waveemapi3.git
cd waveemapi3
cargo build --releaseCreate the data directory. Ensure the user running waveemapi has the correct permissions for the directory.
mkdir dataCopy waveemapi.toml.example into waveemapi.toml.
If your data folder is not in the same directory as Cargo.toml, or is called anything other than data, please declare it under data_path in the configuration file. Alternatively as an environment variable, see the environment variable section for more info.
Copy docker-compose.yml.example into docker-compose.yml.
Edit the tokens and other environment variables to your liking.
Run Docker Compose:
docker-compose up -dVerify the service is running:
docker-compose psReturns a simple JSON status response.
{
"status": "Online"
}Accepts a multipart form upload:
wav: The WAV file to convert.- Requires a bearer token, if authentication is enabled.
curl -X POST \
-H "Authorization: Bearer your_token" \
-F "wav=@path/to/file.wav" \
http://localhost:8000/api/uploadReturns a raw MP3 file, or a multitude of errors.
waveemapi uses a configuration file named waveemapi.toml and supports environment variable overrides.
Note: waveemapi inherits all of Rocket's available settings.
[default]
# Limits for form uploads
limits = { form = "1 GiB", data-form = "1 GB", file = "500 MB" }
# API authentication tokens. Add tokens to enable bearer token authentication.
auth_tokens = [
"your_secret_token"
]
# Enable or disable authentication. Set to `false` to bypass authentication.
auth_enabled = true
# How often the data folder should be cleaned.
cleanup_interval_minutes = 5
# Only delete files older than this during cleanup.
file_expiry_minutes = 10You can override the configuration using environment variables. The following variables are supported:
WAVEEMAPI_DATA_PATH: Path to the directory where data files are stored.WAVEEMAPI_AUTH_ENABLED: Set totrueorfalseto enable or disable authentication.WAVEEMAPI_PROFILE: Specify the configuration profile to use (e.g.,default).WAVEEMAPI_AUTH_TOKENS: A list of API tokens.WAVEEMAPI_CLEANUP_INTERVAL_MINUTES: How often the data folder should be cleaned.WAVEEMAPI_FILE_EXPIRY_MINUTES: How old the files deleted during cleanup have to be.
export WAVEEMAPI_DATA_PATH="/path/to/data"
export WAVEEMAPI_AUTH_ENABLED=trueAs stated earlier, this project is licensed under the LGPL license, see LICENSE.