diff --git a/.gitea/workflows/autoapprove.yml b/.gitea/workflows/autoapprove.yml deleted file mode 100644 index 5bf5d9f..0000000 --- a/.gitea/workflows/autoapprove.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: "autoapprove" - -on: - pull_request_target: - types: [assigned, opened, synchronize, reopened] - -permissions: - pull-requests: write - contents: write - -jobs: - autoapprove: - runs-on: ubuntu-latest - steps: - - name: approve - uses: hmarr/auto-approve-action@v3 - if: github.actor == 'vtolstov' || github.actor == 'dependabot[bot]' - id: approve - with: - github-token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.gitea/workflows/automerge.yml b/.gitea/workflows/automerge.yml deleted file mode 100644 index 5ff3f69..0000000 --- a/.gitea/workflows/automerge.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: "automerge" - -on: - pull_request_target: - types: [assigned, opened, synchronize, reopened] - -permissions: - pull-requests: write - contents: write - -jobs: - automerge: - runs-on: ubuntu-latest - if: github.actor == 'vtolstov' - steps: - - name: merge - id: merge - run: gh pr merge --auto --merge "$PR_URL" - env: - PR_URL: ${{github.event.pull_request.html_url}} - GITHUB_TOKEN: ${{secrets.TOKEN}} diff --git a/redis.go b/redis.go index 9db91f4..ae01f31 100755 --- a/redis.go +++ b/redis.go @@ -98,11 +98,7 @@ func (r *Store) Connect(ctx context.Context) error { } func (r *Store) Init(opts ...store.Option) error { - for _, o := range opts { - o(&r.opts) - } - - err := r.configure() + err := r.configure(opts...) if err != nil { return err } @@ -675,11 +671,15 @@ func NewStore(opts ...store.Option) *Store { } } -func (r *Store) configure() error { - if r.cli != nil && r.opts.Context == nil { +func (r *Store) configure(opts ...store.Option) error { + if r.cli != nil && len(opts) == 0 { return nil } + for _, o := range opts { + o(&r.opts) + } + universalOptions := DefaultUniversalOptions if r.opts.Context != nil { @@ -708,8 +708,8 @@ func (r *Store) configure() error { universalOptions.ConnMaxIdleTime = o.ConnMaxIdleTime universalOptions.ConnMaxLifetime = o.ConnMaxLifetime - if r.opts.TLSConfig != nil { - universalOptions.TLSConfig = r.opts.TLSConfig + if o.TLSConfig != nil { + universalOptions.TLSConfig = o.TLSConfig } } @@ -742,15 +742,15 @@ func (r *Store) configure() error { universalOptions.MaxIdleConns = o.MaxIdleConns universalOptions.ConnMaxIdleTime = o.ConnMaxIdleTime universalOptions.ConnMaxLifetime = o.ConnMaxLifetime - if r.opts.TLSConfig != nil { - universalOptions.TLSConfig = r.opts.TLSConfig + if o.TLSConfig != nil { + universalOptions.TLSConfig = o.TLSConfig } } if o, ok := r.opts.Context.Value(universalConfigKey{}).(*goredis.UniversalOptions); ok { universalOptions = o - if r.opts.TLSConfig != nil { - universalOptions.TLSConfig = r.opts.TLSConfig + if o.TLSConfig != nil { + universalOptions.TLSConfig = o.TLSConfig } } }