Currently, SetupDaemonConfig needs a concrete instance of logrus and a file. This PR removes the need of a file. It's bad practice to accept a filename as parameter: https://100go.co/?h=file#using-a-filename-as-a-function-input-46. If consumers want, they can pass a string.
Accepting a filename as a function input to read from a file should, in most cases, be considered a code smell (except in specific functions such as os.Open). Indeed, it makes unit tests more complex because we may have to create multiple files. It also reduces the reusability of a function (although not all functions are meant to be reused). Using the io.Reader interface abstracts the data source. Regardless of whether the input is a file, a string, an HTTP request, or a gRPC request, the implementation can be reused and easily tested.
Currently,
SetupDaemonConfig
needs a concrete instance oflogrus
and a file. This PR removes the need of a file. It's bad practice to accept a filename as parameter: https://100go.co/?h=file#using-a-filename-as-a-function-input-46. If consumers want, they can pass a string.