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 --release
Create the data directory. Ensure the user running waveemapi has the correct permissions for the directory.
mkdir data
Copy 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 -d
Verify the service is running:
docker-compose ps
Returns 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/upload
Returns 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
You 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 totrue
orfalse
to enable or disable authentication.WAVEEMAPI_PROFILE
: Specify the configuration profile to use (e.g.,default
).WAVEEMAPI_AUTH_TOKENS
: A list of API tokens.
export WAVEEMAPI_DATA_PATH="/path/to/data"
export WAVEEMAPI_AUTH_ENABLED=true
As stated earlier, this project is licensed under the LGPL license, see LICENSE.