Documentation
¶
Index ¶
- Constants
- Variables
- func AuthHandler(f *HtpasswdFile, h http.Handler) http.HandlerFunc
- func CheckBlob(w http.ResponseWriter, r *http.Request)
- func CheckConfig(w http.ResponseWriter, r *http.Request)
- func CreateRepo(w http.ResponseWriter, r *http.Request)
- func DeleteBlob(w http.ResponseWriter, r *http.Request)
- func DeleteConfig(w http.ResponseWriter, r *http.Request)
- func GetBlob(w http.ResponseWriter, r *http.Request)
- func GetConfig(w http.ResponseWriter, r *http.Request)
- func ListBlobs(w http.ResponseWriter, r *http.Request)
- func NewMux() *goji.Mux
- func SaveBlob(w http.ResponseWriter, r *http.Request)
- func SaveConfig(w http.ResponseWriter, r *http.Request)
- type HtpasswdFile
Constants ¶
const CheckInterval = 30 * time.Second
CheckInterval represents how often we check for changes in htpasswd file.
Variables ¶
var Config = struct { Path string Listen string Log string CPUProfile string TLSKey string TLSCert string TLS bool AppendOnly bool Prometheus bool Debug bool }{ Path: "/tmp/restic", Listen: ":8000", AppendOnly: false, }
Config struct holds program configuration.
Functions ¶
func AuthHandler ¶
func AuthHandler(f *HtpasswdFile, h http.Handler) http.HandlerFunc
AuthHandler wraps h with a http.HandlerFunc that performs basic authentication against the user/passwords pairs stored in f and returns the http.HandlerFunc.
func CheckBlob ¶
func CheckBlob(w http.ResponseWriter, r *http.Request)
CheckBlob tests whether a blob exists.
func CheckConfig ¶
func CheckConfig(w http.ResponseWriter, r *http.Request)
CheckConfig checks whether a configuration exists.
func CreateRepo ¶
func CreateRepo(w http.ResponseWriter, r *http.Request)
CreateRepo creates repository directories.
func DeleteBlob ¶
func DeleteBlob(w http.ResponseWriter, r *http.Request)
DeleteBlob deletes a blob from the repository.
func DeleteConfig ¶
func DeleteConfig(w http.ResponseWriter, r *http.Request)
DeleteConfig removes a config.
func GetBlob ¶
func GetBlob(w http.ResponseWriter, r *http.Request)
GetBlob retrieves a blob from the repository.
func GetConfig ¶
func GetConfig(w http.ResponseWriter, r *http.Request)
GetConfig allows for a config to be retrieved.
func ListBlobs ¶
func ListBlobs(w http.ResponseWriter, r *http.Request)
ListBlobs lists all blobs of a given type in an arbitrary order.
func SaveBlob ¶
func SaveBlob(w http.ResponseWriter, r *http.Request)
SaveBlob saves a blob to the repository.
func SaveConfig ¶
func SaveConfig(w http.ResponseWriter, r *http.Request)
SaveConfig allows for a config to be saved.
Types ¶
type HtpasswdFile ¶
HtpasswdFile is a map for usernames to passwords.
func NewHtpasswdFromFile ¶
func NewHtpasswdFromFile(path string) (*HtpasswdFile, error)
NewHtpasswdFromFile reads the users and passwords from a htpasswd file and returns them. If an error is encountered, it is returned, together with a nil-Pointer for the HtpasswdFile.
func (*HtpasswdFile) Reload ¶ added in v0.9.6
func (h *HtpasswdFile) Reload() error
Reload reloads the htpasswd file. If the reload fails, the Users map is not changed and the error is returned.
func (*HtpasswdFile) ReloadCheck ¶ added in v0.9.6
func (h *HtpasswdFile) ReloadCheck() error
ReloadCheck checks at most once per CheckInterval if the file changed and will reload the file if it did. It logs errors and successful reloads, and returns an error if any was encountered.