Merge pull request #4403 from MichaelEischer/fix-certificate-env-handling

Fix certificate env handling
This commit is contained in:
Michael Eischer 2023-07-09 14:46:38 +02:00 committed by GitHub
commit 7042190807
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 3 deletions

View File

@ -141,6 +141,14 @@ jobs:
run: |
go run build.go
- name: Minimal test
run: |
./restic init
./restic backup .
env:
RESTIC_REPOSITORY: ../testrepo
RESTIC_PASSWORD: password
- name: Run local Tests
env:
RESTIC_TEST_FUSE: ${{ matrix.test_fuse }}

View File

@ -151,7 +151,9 @@ func init() {
globalOptions.PasswordFile = os.Getenv("RESTIC_PASSWORD_FILE")
globalOptions.KeyHint = os.Getenv("RESTIC_KEY_HINT")
globalOptions.PasswordCommand = os.Getenv("RESTIC_PASSWORD_COMMAND")
globalOptions.RootCertFilenames = strings.Split(os.Getenv("RESTIC_CACERT"), ",")
if os.Getenv("RESTIC_CACERT") != "" {
globalOptions.RootCertFilenames = strings.Split(os.Getenv("RESTIC_CACERT"), ",")
}
globalOptions.TLSClientCertKeyFilename = os.Getenv("RESTIC_TLS_CLIENT_CERT")
comp := os.Getenv("RESTIC_COMPRESSION")
if comp != "" {
@ -582,7 +584,7 @@ func open(ctx context.Context, s string, gopts GlobalOptions, opts options.Optio
rt, err := backend.Transport(globalOptions.TransportOptions)
if err != nil {
return nil, err
return nil, errors.Fatal(err.Error())
}
// wrap the transport so that the throughput via HTTP is limited
@ -638,7 +640,7 @@ func create(ctx context.Context, s string, gopts GlobalOptions, opts options.Opt
rt, err := backend.Transport(globalOptions.TransportOptions)
if err != nil {
return nil, err
return nil, errors.Fatal(err.Error())
}
factory := gopts.backends.Lookup(loc.Scheme)