A REST API for uploading health data from iOS devices, using the iOS app HealthAutoExport.
The API is a Flask app in a Docker container. It was developed for use in the local network, but it should take minimal effort to make the changes required to host it on a domain.
- Clone the repo.
- Ensure credentials file
credentials.json
is present in the top level directory (see section Authentication for more info). - (Optional) Customize
docker-compose.yml
. - Run
sh docker-rebuild.sh
or use you own command and your own docker-compose.yml
.
When using the supplied docker-compose.yml
and docker-rebuild.sh
, ensure the following:
- That files
.env
and.env.prod
are present. - That
.env
contains environment variableSAVE_DIR
.
-
UPLOAD_DIR
(default:/output
) the output directory inside the container where data is saved to. This value should not be modified when using the Docker container. It's only useful when using the Flask app outside of Docker. -
SAVE_DIR
(default:/output
): the output directory outside the container, to which/output
is bound to. -
Flask settings such as
MAX_CONTENT_LENGTH
can be set as environment variables, either directly, or in.env.prod
file.
The app uses HTTP basic auth, i.e. username and password, which are stored encoded in a file credentials.json
in the project directory.
Example
username: "dummy-user"
password: "dummy-password"
credentials.json:
{
"dummy-user": <token>
}
where token
token = b64encode(f"{username}:{password}".encode('utf-8')).decode("ascii")
This project is licensed under the MIT License.