mrkaye97 / slackr

An R package for sending messages from R to Slack
https://matthewrkaye.com/slackr/
Other
307 stars 85 forks source link

Allow user to set config_file via environment variable #194

Closed botan closed 11 months ago

botan commented 1 year ago

Currently, the default value for the config_file argument is "~.slackr"

slackr_setup(
  channel = "#general",
  username = "slackr",
  icon_emoji = "",
  incoming_webhook_url = "",
  token = "",
  config_file = "~/.slackr",
  echo = FALSE,
  cache_dir = ""
) 

and if a user need to use another path, they have to set it in every function call explicitly e.g.

slackr_setup(config_file = "/etc/slackr")

however, this could be easily solved by setting an environment variable in .Renviron and passing it while keeping the default value the same like below

slackr_setup(
  channel = "#general",
  username = "slackr",
  icon_emoji = "",
  incoming_webhook_url = "",
  token = "",
  config_file = Sys.getenv("SLACKR_CONFIG_FILE", unset = "~/.slackr"),
  echo = FALSE,
  cache_dir = ""
) 

Happy to make a PR if you think that's okay.

mrkaye97 commented 1 year ago

Great idea! If you're willing to submit a PR I'd be happy to review + get it shipped. Thanks!

stale[bot] commented 12 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

mrkaye97 commented 11 months ago

Still need to merge in -- will get around to this in a bit