Sampriti-Mitra / dialogflow-slack-sdk

SDK to use Dialogflow CX on Slack-Set up an integration deployment to link your Dialogflow agent to slack
Apache License 2.0
8 stars 5 forks source link

Create token interface to get mock tokens #41

Open Sampriti-Mitra opened 3 years ago

Sampriti-Mitra commented 3 years ago

For fetching mock/default tokens for tests, add an interface. Also remove the tokens being hardcoded in the code and fetch it from env variable

Sampriti-Mitra commented 3 years ago

Refer https://github.com/Sampriti-Mitra/dialogflow-slack-sdk/blob/main/functions/config/token.go for token file

RomanSerikov commented 3 years ago

I want to take this one, but i have a couple of questions :)

  1. Is it ok to add this package https://github.com/kelseyhightower/envconfig to get values from Environment, or it should be solved without any third-party libraries?
  2. There are 7 configuration values:
    • BOT_TOKEN
    • APP_TOKEN
    • CREDENTIALS_PATH
    • SLACK_SIGNING_SECRET
    • VERIFY_SECRET
    • PROJECT_ID
    • AGENT_NAME

Are they all necessary or some of them are optional?

  1. Is it ok to return error in main.go if some of required configuration values are missing in Environment?
  2. Is it really necessary to make an interface or it's ok to make some default configuration values for testing purposes?
RomanSerikov commented 3 years ago

@Sampriti-Mitra hey? :)

Sampriti-Mitra commented 3 years ago

@RomanSerikov Sorry about the late reply, was caught up elsewhere and couldn't revert. Regarding your questions

  1. Yes, this package can be added
  2. All of them are required
  3. Yes
  4. Interface would be better, but you can go ahead with the default config too :) Hope that answers you questions :)