2024-03-14 19:53:10 +01:00
# Currency Exchange
Currency exchange app using ExchangeRate-API.\
To use, need ExchangeRate-API Key which is obtainable [here ](https://www.exchangerate-api.com/ )
## Usage
Before using get your API-KEY and set it up with command or by using interactive mode
```
currency-exchange --set-api-key < API_KEY >
# or
currency-exchange --interactive
```
More information on usage:
```
2024-03-14 19:59:33 +01:00
Usage: currency-exchange [OPTIONS] [Currency input] [Currency target] [Amount]
2024-03-14 19:53:10 +01:00
Arguments:
2024-03-14 19:59:33 +01:00
[Currency input] Currency code to exchange from
[Currency target] Currency code to exchange to
[Amount] Currency amount to exchange
2024-03-14 19:53:10 +01:00
Options:
2024-03-14 19:59:33 +01:00
-k, --set-api-key < API_KEY > Set api key
2024-03-15 12:45:28 +01:00
-r, --recreate-cache Recreate cache
2024-03-14 19:59:33 +01:00
-i, --interactive Interactive mode
-l, --list List currencies
-L, --list-rates < currency > List exchange rate for currency
-h, --help Print help
2024-03-14 19:53:10 +01:00
```
2024-03-20 13:01:59 +01:00
Cache and api key is stored by default in `<XDG_CACHE_HOME>/currencyCache.db` or `<TMPDIR>/currencyCache.db` if `XDG_CACHE_HOME` is not set. This location and filename can be overriden by setting up `CURRENCY_CACHE` env variable.
2024-03-20 00:17:30 +01:00
2024-03-15 15:53:03 +01:00
## Build
2024-03-14 19:53:10 +01:00
Needs rust and cargo, build tested on rust v1.76.0\
To build run command
```
cargo build -r
```
2024-03-15 15:53:03 +01:00
## Docker
2024-03-19 19:31:01 +01:00
[![status ](https://github.com/materusPL/currency-exchange-rust/actions/workflows/main.yml/badge.svg )](https://hub.docker.com/repository/docker/materus/currency-exchange)
2024-03-15 15:53:03 +01:00
2024-03-18 14:57:26 +01:00
To run with docker use:
2024-03-15 15:53:03 +01:00
```
2024-03-18 14:57:26 +01:00
docker run -it --rm -v /tmp:/tmp:rw materus/currency-exchange:latest < ARGUMENTS >
2024-03-15 15:53:03 +01:00
```
2024-03-20 13:01:59 +01:00
Dockerfile sets up `CURRENCY_CACHE` to `/tmp/docker_currency_cache.db` , to keep cache u should mount this file or tmp directory for example with `-v /tmp:/tmp:rw` in docker run cmdline.
2024-03-15 15:53:03 +01:00