Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add ACCESS_TOKEN in .env.example #29

Closed
wants to merge 3 commits into from

Conversation

wolfsilver
Copy link
Contributor

Add ACCESS_TOKEN to .env.example and read it in NewService function.

  • config.go

    • Add AccessToken field to Config struct.
    • Parse and load ACCESS_TOKEN from the environment in getConfigFromEnv function.
  • memogram.go

    • Read ACCESS_TOKEN from the configuration in NewService function.
    • If ACCESS_TOKEN is not blank, split it with :, get userId and access_token, and store them in userAccessTokenCache.
  • .env.example

    • Add ACCESS_TOKEN variable in the format userId:access_token.

For more details, open the Copilot Workspace session.

Fixes #25

.env.example Outdated
BOT_TOKEN=your_bot_token
ACCESS_TOKEN=userId:access_token
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add more info, what is "userId" and how is one supposed to get it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

userId is telegram user id. use bot @userinfobot to get userId.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I figured it out, but what I meant is that it might not be obvious for the users. Can we specify telegram username here (like @myname)? Or add the actual info how to get this ID to readme or comments somewhere...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

readme updated.

@boojack
Copy link
Member

boojack commented Aug 26, 2024

It's better to use a simple text file to store this data. Implemented with 5d7dc80

@boojack boojack closed this Aug 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Configurable Auth Token
3 participants