Configuration
The server is configured in environment variables. This page will go over some common configurations, that you can do.
Currency
The Metekasse server gets its information about a currency from a repo called
mete-currency-store.
If you set METE_SERVER_CURRENCY to a
ISO 4217 value
of currency, which the repo already has information about, it will automatically
download it and store a copy to your server.
Adding custom currencies
You can add a yaml file to the currency folder, which defines your custom
currency. Set METE_SERVER_CURRENCY to the name of the yaml file.
(without the extension)
See Adding a currency over at the mete-currency-store repo for more details how to format, that file.
Authentication
Authentication is used by the server to make sure not everyone can create/modify products. By default authentication is disabled and all requests are accepted.
Passphrase
If you want to use authentication, you can use a passphrase. To setup the server to use authentication, you need to do:
- Set the environment variable
METE_AUTH_TYPEtoPASSPHRASE. - Set a bcrypt hash as
METE_AUTH_PASSPHRASE. For this you can use tools like IT Tools or python:python3 -c "import bcrypt; print(bcrypt.hashpw(b'$passphrase', bcrypt.gensalt()))"
In the end your envionment should have these two lines:
METE_AUTH_TYPE="PASSPHRASE"
METE_AUTH_PASSPHRASE="$2a$10$0DA8QYGqtf94J114viCpnuUv4ky2Fzjport6u60FGEEmlUCZWQ3Cq" # Metekasse
Credit Limit
There is a credit limit you can setup. This will prevent buying products, if the
balance will get lower than the credit limit in the negatives. This only applies
to purchasing products. Modifing the user record using PATCH /api/v4/users/<ID>
will not prevent going under the credit limit.
To set the credit limit, use the variable: METE_SERVER_GLOBAL_CREDIT_LIMIT.
The value is considered as cents.
Example
The credit limit is set to 10EUR, that means a user can have -10EUR.
Now the user has -10EUR in her account and wants to buy a product. The request will fail, due to the credit limit. Now the user adds 50 cents to her account and thus she will have a balance of -9.50EUR and now she buys a product with the price of 25 cents. This will work. The balance is now -9.75EUR. If she would request to buy a product with the price of 50 cents, it would stop.
File Settings
The avatars and images for products stored in the /api/v4/images-endpoints.
The allowed sizes and formats are the following variables:
METE_SERVER_MAX_FILESIZE: This defines, how large the files are allowed, before getting rejected. Its defined in megabytes and can be set in decimals (use.as decimal point).METE_SERVER_SUPPORTED_IMAGE_MIME_TYPES: This defines, what mime types are allowed. See IANA Assignments
Others
For a complete overview of both valid entries and defaults, see: example.env