This microservice allows you to upload and download files to a third-party service. Google Cloud Storage, MongoDB and Amazon s3 are currently supported. Consequently, it needs to know a MongoDB in which to save the files, a valid Amazon s3 bucket configuration or a Google Storage credentials.
In addition, after each upload it saves the file's information using the CRUD Service on a configurable mongoDB collection (usually files).
- CONFIG_FILE_PATH (required): the path of the configuration file to configure connection with the online bucket for the supported services
- CRUD_URL (required): the crud url, comprehensive of the files collection name
- PROJECT_HOSTNAME: the hostname that will be saved in the database as the root of the file location
- PATH_PREFIX: Use a relative path as file location prefix. Incompatible with PROJECT_HOSTNAME
- HEADERS_TO_PROXY: comma separated list of the headers to proxy (the Mia-Platform headers)
- TRUSTED_PROXIES (required): the string containing the trusted proxies values
- ADDITIONAL_FUNCTION_CASTER_FILE_PATH: the path of the file that exports the function to cast.
- GOOGLE_APPLICATION_CREDENTIALS: the path to access to the google storage credentials. This is required for GoogleStorage type.
One of PATH_PREFIX and PROJECT_HOSTNAME is required.
The storage service configuration must follow this json schema:
This configuration allows to store files on any S3-compatibile object storage.
Example: Amazon S3 : To use Amazon S3 you should configure the files-service as follows:
Example: Oracle Object Storage S3 Compatible: Follow the documentation to obtain a pair of customer access and secret keys.
For this configuration, should be add
GOOGLE_APPLICATION_CREDENTIALS env variable and the credential file. To obtain the configuration file, follow this guide.
This file looks like
Once obtained this file, you should not commit
private-key is a certificate with newline code (
\n). In order to interpolate with in deploy stage of gitlab ci, it should be saved replacing
An example for a custom caster file. This file add (if present in the post parameters) the tags, authorId and ownerId params to crud collection.