Configuration Parameters¶
In this section you will find all options which are configurable to make a device fit your needs.
Create a file called .muscleenv (alternatively .env) in the top level directory of the device source, where you export all configuration parameters.
Below are the configurable parameters of the following form:
CONFIGURATION_PARAMETER = default_value
Authentication¶
Warning
As default, anyone in possession of the IP of the device can access it, so make sure to enable authentication to enforce the user to be authenticated.
AUTHENTICATION_BACKEND = None
The backend which authenticates a user before he can access any functionality on the device. Specify the full URL of the backend which is also configured in the webapp, i.e. https://backend.my-muscle.com. This will force each method to authenticate the user. If you only want a selection of them, configure AUTHENTICATED_METHODS to your needs.
If this is left on default, no authentication takes place and anyone can access the device.
AUTHENTICATED_METHODS = *
The methods which must authenticate the user before he can access the functionality. To use this, the AUTHENTICATION_BACKEND must be configured, otherwise this configuration is ignored. Defaults to all methods, specify a comma separated list of methods if you only want a selection of them.
The methods accepted are: ping, info, monitor, record, execute, stop, upload, download
Note
When AUTHENTICATION_BACKEND is configured, the device calls
GET {AUTHENTICATION_BACKEND}/api/dev-auth, forwarding the client’s Authorization header
unchanged. A successful response is cached for up to 10 minutes (or until the token expires, whichever is
sooner), capped at 6 cached tokens - meaning the backend is not called on every single request, so
revoking a user’s access is not immediate.
Warning
Authentication is bypassed entirely whenever the device runs with Flask’s debug/development server
(FLASK_DEBUG=1 / flask run), regardless of the AUTHENTICATION_BACKEND setting.
Make sure to serve the device with a production server before relying on
authentication.
Logging¶
LOG_PATH = <DEVICE_INSTALL_DIR>/logs/
Where the access and application logs will be stored.
Note
Setting this to /dev together with DEVICE_LOG_FILE/ACCESS_LOG_FILE set to
stdout routes logs to the process’s standard output/error instead of files - this is what the
docker image uses by default.
LOG_MAX_SIZE = 10485760
Maximum size of one log file in Bytes, default is 10MiB. When the size is reached a new one will be created, at maximum LOG_MAX_BACKUPS before the oldest gets overwritten.
LOG_MAX_BACKUPS = 5
How many log files to store before overwriting the oldest one.
DEVICE_LOG_FILE = muscle_device.log
The name of the device log file.
DEVICE_LOG_LEVEL = INFO
Log level for the device log. Can be either DEBUG, INFO, WARNING, ERROR or CRITICAL
ACCESS_LOG_ENABLE = true
Enable server access logs.
ACCESS_LOG_FILE = muscle_access.log
The name of the access log file.
Files¶
DOWNLOAD_FILE = <DEVICE_INSTALL_DIR>/misc/data.csv
The absolute path and name of the download file.
UPLOAD_FILE = <DEVICE_INSTALL_DIR>/misc/upload
The absolute path and name of the upload file, but without extension, because you can adjust upload extensions in file-upload. Uploaded files will be named with the correct extension.
Cross Origin Resource Sharing¶
CORS_ORIGINS = *
A comma separated list of domains which are allowed to access this device. Note that this does not blacklist a utility like CURL to access the device, read about CORS for more information. Defaults to any.
Preferably this will be the URL over which you access the webapp.