Currency exchange app written in rust
This repository has been archived on 2024-04-05. You can view files and clone it, but cannot push or open issues/pull-requests.
 
 
Go to file
Mateusz Słodkowicz d0ea16c0b0
Create LICENSE
2024-03-25 15:03:44 +01:00
.github/workflows Update main.yml 2024-03-18 15:47:50 +01:00
src Move mocked test to own mod 2024-03-22 12:52:36 +01:00
.dockerignore Add Dockerfile 2024-03-15 15:49:23 +01:00
.gitignore Initial commit 2024-03-14 19:41:40 +01:00
Cargo.lock Get rid of tokio and rust_decimal_macros, use blocking reqwest 2024-03-21 11:33:32 +01:00
Cargo.toml Get rid of tokio and rust_decimal_macros, use blocking reqwest 2024-03-21 11:33:32 +01:00
Dockerfile Changes to cache location 2024-03-20 12:55:10 +01:00
LICENSE Create LICENSE 2024-03-25 15:03:44 +01:00
README.md Update README.md 2024-03-20 13:01:59 +01:00
rustfmt.toml Initial commit 2024-03-14 19:41:40 +01:00

README.md

Currency Exchange

Currency exchange app using ExchangeRate-API.
To use, need ExchangeRate-API Key which is obtainable here

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:

Usage: currency-exchange [OPTIONS] [Currency input] [Currency target] [Amount]

Arguments:
  [Currency input]   Currency code to exchange from
  [Currency target]  Currency code to exchange to
  [Amount]           Currency amount to exchange

Options:
  -k, --set-api-key <API_KEY>  Set api key
  -r, --recreate-cache         Recreate cache
  -i, --interactive            Interactive mode
  -l, --list                   List currencies
  -L, --list-rates <currency>  List exchange rate for currency
  -h, --help                   Print help

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.

Build

Needs rust and cargo, build tested on rust v1.76.0
To build run command

cargo build -r

Docker

status

To run with docker use:

docker run -it --rm -v /tmp:/tmp:rw materus/currency-exchange:latest <ARGUMENTS>

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.