Skip to content

NODO-UH/uh-email-quota

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

uh-email-quota

Description

This microservice is designed to provide information on the consumption of space in the email given a given user, giving the space consumed and the maximum possible.

Table of Contents

Installation

Quota Scraper is developed in the Go language, so one of the ways to install it is by compiling the source code, or by downloading any of the previously compiled releases.

Compiling

The only requirement to compile the code is to have Go. Once the repository is cloned and all the dependencies are in the GOPATH, it can be compiled from the file insrc/main.go.

Release

If you want to download a compilation directly, simply go to the releases in this repository and choose the desired version. If you can't find support for a certain architecture, feel free to open an issue to let us know.

Usage

This microservice runs a REST API on port 8080, in addition, it requires the existence of the doveadm command, with which the consumption of each user is consulted. For security reasons, the header X-API-Key must be sent in each request with a unique key that only the administrator should know, the key is taken from the environment variableEMAIL_QUOYA_API_KEY.

For example, if you want to know the consumption of the user [email protected]. A request must be sent with the GET method and to the pathhost:8080/[email protected], with the header X-API-Key containing the correct key. If the key matches the one stored in EMAIL_QUOYA_API_KEY, then we proceed to find the consumption using thedoveadm command:

doveadm -f tab quota get -u [email protected]

Then it reads the output and returns the result through the REST API through a JSON of the form:

{
    "value": "consumed in bytes",
    "limit": "limit in bytes"
}

For example:

{
    "value": 1024,
    "limit": 2048
}