jxskiss / simplessl

On the fly SSL certificate issue and renewal inside OpenResty with Let's Encrypt
MIT License
46 stars 13 forks source link

RedisConfig uses default value #11

Closed devzorg closed 2 years ago

devzorg commented 2 years ago

openresty-ssl-server-1 | 2022-09-15T11:26:55.775Z ERROR server server/server.go:94 failed get certificate, typ= ACME_ON_DEMAND, name= *******.info {"error": "dial tcp 127.0.0.1:6379: connect: connection refused"}

but it defined as

storage:
  type: "redis"  # or redis
  dir_cache: "/app/storage"
  redis:
    addr: "redis:6379"
    prefix: ""

please also add DB in struct to make possible choose db index, and may some more options like password and etc able in default lib of redis

jxskiss commented 2 years ago

Good point

jxskiss commented 2 years ago

Hi @devzorg, I have checked the doc of go-redis, the configuration already supports chosing db and other options, you can specify it as redis://<user>:<password>@<host>:<port>/<db_number>, you may check https://pkg.go.dev/github.com/go-redis/redis/v8#ParseURL for details of the format.

jxskiss commented 2 years ago

Though, this is a good issue, I will update the example conf to make it a little clear of the format.

devzorg commented 2 years ago

Hi @devzorg, I have checked the doc of go-redis, the configuration already supports chosing db and other options, you can specify it as redis://<user>:<password>@<host>:<port>/<db_number>, you may check https://pkg.go.dev/github.com/go-redis/redis/v8#ParseURL for details of the format.

you mean using the 'addr' key of yml config ? your RedisConfig definesonly 'addr' and 'prefix'

jxskiss commented 2 years ago

Yes, use redis://<user>:<password>@<host>:<port>/<db_number> as value of addr to specify options to connect to Redis.

jxskiss commented 2 years ago

Fixed by #12, going to close this.