jmakhack / myanimelist-cli

Minimalistic command line interface for fetching user anime data from MyAnimeList.
https://aur.archlinux.org/packages/mya-git
MIT License
11 stars 15 forks source link

[TASK] Add retrieval of an environment variable for Client ID #99

Closed jmakhack closed 1 year ago

jmakhack commented 1 year ago

Task Context

Currently in order for this project to function as intended, users would have to open the source file and manually add in their MyAnimeList token. This is generally a bad practice and prevents this project from having a good CI/CD process in place.

https://github.com/jmakhack/myanimelist-cli/blob/587fa4fd9f96166e7c4583576ab701df2b1224cd/src/mya.c#L14

Acceptance Criteria

Instead of requiring the token to be added within the source file, update the code to read from an environment variable instead. This environment variable should be named something like MYANIMELIST_CLIENT_ID.

The Contribution docs should also be updated with the accurate instructions on how to set the CLIENT_ID.

Though not required for the completion of this specific task, proper error handling in case the environment variable does not exist or is an invalid value would be a nice bonus.

Additional Context

The getenv() function found in the stdlib library is one potential way to complete this task: https://www.tutorialspoint.com/c_standard_library/c_function_getenv.htm

Please read through the Contributing to the Project document before working on this project.