This application was created as a test task to join Polytech Software.
In this application I implemented two weather providers, namely OpenWeather and WeatherApi.
One can choose to get weather from either, but the output will be slightly different because
of provider-related differences in weather information.
The provider configuration file is saved to $CONFIG_DIR/weatherapp/provider
.
This note mainly concerns API keys. Since the API keys must be read from a local file,
it cannot be considered "production-ready", since it will not be installable using
cargo install
. On the other hand, I choose not to implement platform-specific builds
for Docker image or binary distribution because of the API key reason. If I really had to build
a minimal, but production-ready app, it would require at least some "proxy" infrastructure,
where the requests would be made to some proxy server that can access the API keys (hosted
in some service like Redis/Kong, or cloud primitives, like k8s secrets), which would in turn forward
the requests to real providers with the API keys added.
There are two ways to run the project. First approach is to build the project from source
with api keys provided in apikeys.conf
. NOTE: one needs to create
the file using the syntax in apikeys.example.conf
.
Since the app uses cross-platform libraries, it easily compiles to all targets (Windows, OSX, Linux).
To get the weather, simply invoke:
cargo run --release -- get <LOCATION>
If the location consists more than two words, please encase them in double quotes ("").
To change the provider, simply invoke:
cargo run --release -- configure (openweather|weatherapi)
To get the weather, simply invoke:
weather get <LOCATION>
If the location consists more than two words, please encase them in double quotes ("").
To change the provider, simply invoke:
weather configure (openweather|weatherapi)