fix: env init (#33)

This commit is contained in:
Lakhan Samani
2021-07-28 11:53:37 +05:30
committed by GitHub
parent 0fd4f18dc1
commit ea320c2401
11 changed files with 190 additions and 188 deletions

View File

@@ -13,21 +13,21 @@ type RedisStore struct {
}
func (c *RedisStore) AddToken(userId, token string) {
err := c.store.Set(c.ctx, "yauth_"+userId, token, 0).Err()
err := c.store.Set(c.ctx, "authorizer_"+userId, token, 0).Err()
if err != nil {
log.Fatalln("Error saving redis token:", err)
}
}
func (c *RedisStore) DeleteToken(userId string) {
err := c.store.Del(c.ctx, "yauth_"+userId).Err()
err := c.store.Del(c.ctx, "authorizer_"+userId).Err()
if err != nil {
log.Fatalln("Error deleting redis token:", err)
}
}
func (c *RedisStore) ClearStore() {
err := c.store.Del(c.ctx, "yauth_*").Err()
err := c.store.Del(c.ctx, "authorizer_*").Err()
if err != nil {
log.Fatalln("Error clearing redis store:", err)
}
@@ -35,7 +35,7 @@ func (c *RedisStore) ClearStore() {
func (c *RedisStore) GetToken(userId string) string {
token := ""
token, err := c.store.Get(c.ctx, "yauth_"+userId).Result()
token, err := c.store.Get(c.ctx, "authorizer_"+userId).Result()
if err != nil {
log.Println("Error getting token from redis store:", err)
}