mirror of
https://github.com/kopia/kopia.git
synced 2026-01-25 23:08:01 -05:00
Those will make it possible to securely host 'kopia server' embedded in a desktop app that runs in the background and can access UI. - added support for using and generating TLS certificates - added /api/v1/shutdown API to remotely trigger server shutdown - added support for automatically shutting down server if no requests arrive in certain amount of time - added support for generating and printing random password to STDERR TLS supports 3 modes: 1. serve TLS using externally-provided cert/key PEM files 2. generate & write PEM files, then serve TLS using them 3. generate and use emphemeral cert/key (prints SHA256 fingerprint)
26 lines
801 B
Go
26 lines
801 B
Go
package cli
|
|
|
|
import (
|
|
"github.com/kopia/kopia/internal/serverapi"
|
|
|
|
"github.com/pkg/errors"
|
|
)
|
|
|
|
var (
|
|
serverAddress = serverCommands.Flag("address", "Server address").Default("http://127.0.0.1:51515").String()
|
|
serverUsername = serverCommands.Flag("server-username", "HTTP server username (basic auth)").Envar("KOPIA_SERVER_USERNAME").Default("kopia").String()
|
|
serverPassword = serverCommands.Flag("server-password", "HTTP server password (basic auth)").Envar("KOPIA_SERVER_PASSWORD").String()
|
|
)
|
|
|
|
func serverAPIClientOptions() (serverapi.ClientOptions, error) {
|
|
if *serverAddress == "" {
|
|
return serverapi.ClientOptions{}, errors.Errorf("missing server address")
|
|
}
|
|
|
|
return serverapi.ClientOptions{
|
|
BaseURL: *serverAddress,
|
|
Username: *serverUsername,
|
|
Password: *serverPassword,
|
|
}, nil
|
|
}
|