Skip to content

Commit

Permalink
Merge pull request #2 from miscord-dev/fix-config-load
Browse files Browse the repository at this point in the history
Fix bugs
  • Loading branch information
tsuzu authored Dec 30, 2024
2 parents 83c1be1 + d8fe816 commit 1165d5a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ jobs:
# Install the cosign tool except on PR
# https://github.com/sigstore/cosign-installer
- name: Install cosign
if: github.event_name != 'pull_request'
uses: sigstore/cosign-installer@59acb6260d9c0ba8f4a2f9d9b48431a222b68e20 #v3.5.0
with:
cosign-release: 'v2.2.4'
Expand All @@ -53,7 +52,6 @@ jobs:
# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
with:
registry: ${{ env.REGISTRY }}
Expand All @@ -76,7 +74,7 @@ jobs:
with:
context: .
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
Expand All @@ -88,7 +86,6 @@ jobs:
# transparency data even for private images, pass --force to cosign below.
# https://github.com/sigstore/cosign
- name: Sign the published Docker image
if: ${{ github.event_name != 'pull_request' }}
env:
# https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable
TAGS: ${{ steps.meta.outputs.tags }}
Expand Down
6 changes: 6 additions & 0 deletions pkg/issuer/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package issuer

import (
"fmt"
"log/slog"
"net/url"
"os"
"strings"
Expand Down Expand Up @@ -53,6 +54,9 @@ func ConfigFromEnvs() (Config, error) {
config.DstPath = os.Getenv("dex_access_token_file")
config.Endpoint = os.Getenv("dex_endpoint")
config.BasicAuth = os.Getenv("dex_basic_auth")
config.Values.Del("access_token_file")
config.Values.Del("endpoint")
config.Values.Del("basic_auth")

var err error
if d := os.Getenv("dex_refresh_before"); d != "" {
Expand All @@ -64,6 +68,8 @@ func ConfigFromEnvs() (Config, error) {
config.RefreshBefore = 1 * time.Hour
}

slog.Debug("config loaded", "config", config)

return config, nil
}

Expand Down
1 change: 1 addition & 0 deletions pkg/issuer/issuer.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ func (iss *tokenIssuer) issue(ctx context.Context, config Config) (string, int,
user, password, _ := strings.Cut(config.BasicAuth, ":")
req.SetBasicAuth(user, password)
}
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")

resp, err := iss.client.Do(req)
if err != nil {
Expand Down

0 comments on commit 1165d5a

Please sign in to comment.