mirror of
https://github.com/cupcakearmy/autorestic.git
synced 2025-09-06 10:30:39 +00:00
Compare commits
10 Commits
Author | SHA1 | Date | |
---|---|---|---|
75160d4d6a | |||
92feaef5bb | |||
2a7e233cdb | |||
a373c07fb0 | |||
ec9e2aebcd | |||
7d87160706 | |||
8e1fe6af65 | |||
|
65ba1f6ac1 | ||
|
6bf4953003 | ||
27758a03fa |
13
CHANGELOG.md
13
CHANGELOG.md
@@ -5,6 +5,19 @@ All notable changes to this project will be documented in this file.
|
|||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [1.5.3] - 2022-02-13
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Error throwing not finding config even it's not being used.
|
||||||
|
|
||||||
|
## [1.5.2] - 2022-02-13
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Config loading @jjromannet
|
||||||
|
- Making a backup of the file @jjromannet
|
||||||
|
|
||||||
## [1.5.1] - 2021-12-06
|
## [1.5.1] - 2021-12-06
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
28
cmd/root.go
28
cmd/root.go
@@ -3,6 +3,7 @@ package cmd
|
|||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/cupcakearmy/autorestic/internal"
|
"github.com/cupcakearmy/autorestic/internal"
|
||||||
"github.com/cupcakearmy/autorestic/internal/colors"
|
"github.com/cupcakearmy/autorestic/internal/colors"
|
||||||
@@ -27,7 +28,7 @@ var rootCmd = &cobra.Command{
|
|||||||
Version: internal.VERSION,
|
Version: internal.VERSION,
|
||||||
Use: "autorestic",
|
Use: "autorestic",
|
||||||
Short: "CLI Wrapper for restic",
|
Short: "CLI Wrapper for restic",
|
||||||
Long: "Documentation: https://autorestic.vercel.app",
|
Long: "Documentation:\thttps://autorestic.vercel.app\nSupport:\thttps://discord.gg/wS7RpYTYd2",
|
||||||
}
|
}
|
||||||
|
|
||||||
func Execute() {
|
func Execute() {
|
||||||
@@ -49,13 +50,21 @@ func initConfig() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if cfgFile != "" {
|
if cfgFile != "" {
|
||||||
|
if internal.VERBOSE {
|
||||||
|
colors.Faint.Printf("> Using config file: %s\n", cfgFile)
|
||||||
|
}
|
||||||
viper.SetConfigFile(cfgFile)
|
viper.SetConfigFile(cfgFile)
|
||||||
|
viper.AutomaticEnv()
|
||||||
|
if viper.ConfigFileUsed() == "" {
|
||||||
|
colors.Error.Println("cannot read config file %s\n", cfgFile)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
viper.AddConfigPath(".")
|
configPaths := []string{"."}
|
||||||
|
|
||||||
// Home
|
// Home
|
||||||
if home, err := homedir.Dir(); err != nil {
|
if home, err := homedir.Dir(); err != nil {
|
||||||
viper.AddConfigPath(home)
|
configPaths = append(configPaths, home)
|
||||||
}
|
}
|
||||||
|
|
||||||
// XDG_CONFIG_HOME
|
// XDG_CONFIG_HOME
|
||||||
@@ -66,10 +75,17 @@ func initConfig() {
|
|||||||
prefix = filepath.Join(home, ".config")
|
prefix = filepath.Join(home, ".config")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
viper.AddConfigPath(filepath.Join(prefix, "autorestic"))
|
xdgConfig := filepath.Join(prefix, "autorestic")
|
||||||
|
configPaths = append(configPaths, xdgConfig)
|
||||||
}
|
}
|
||||||
|
for _, cfgPath := range configPaths {
|
||||||
viper.SetConfigName(".autorestic")
|
viper.AddConfigPath(cfgPath)
|
||||||
}
|
}
|
||||||
|
if internal.VERBOSE {
|
||||||
|
colors.Faint.Printf("Using config paths: %s\n", strings.Join(configPaths, " "))
|
||||||
|
}
|
||||||
|
cfgFileName := ".autorestic"
|
||||||
|
viper.SetConfigName(cfgFileName)
|
||||||
viper.AutomaticEnv()
|
viper.AutomaticEnv()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -2,17 +2,18 @@
|
|||||||
|
|
||||||
This amazing people helped the project!
|
This amazing people helped the project!
|
||||||
|
|
||||||
- @agateblue - Docs, Pruning, S3
|
- @agateblue - Docs, Pruning, S3.
|
||||||
- @g-a-c - Update/Install bugs.
|
- @g-a-c - Update/Install bugs.
|
||||||
- @david-boles - Docs
|
- @jjromannet - Bug fixes.
|
||||||
- @SebDanielsson - Brew
|
- @david-boles - Docs.
|
||||||
- @n194 - AUR Package
|
- @SebDanielsson - Brew.
|
||||||
- @jin-park-dev - Typos
|
- @n194 - AUR Package.
|
||||||
- @sumnerboy12 - Typos
|
- @jin-park-dev - Typos.
|
||||||
- @FuzzyMistborn - Typos
|
- @sumnerboy12 - Typos.
|
||||||
- @ChanceM - Typos
|
- @FuzzyMistborn - Typos.
|
||||||
- @TheForcer - Typos
|
- @ChanceM - Typos.
|
||||||
- @themorlan - Typos
|
- @TheForcer - Typos.
|
||||||
- @somebox - Typos
|
- @themorlan - Typos.
|
||||||
|
- @somebox - Typos.
|
||||||
|
|
||||||
> :ToCPrevNext
|
> :ToCPrevNext
|
||||||
|
@@ -10,7 +10,7 @@ For remote backups (S3, B2, GCS, etc.) it's quite easy, as you only need to moun
|
|||||||
docker run --rm \\
|
docker run --rm \\
|
||||||
-v $(pwd):/data \\
|
-v $(pwd):/data \\
|
||||||
cupcakearmy/autorestic \\
|
cupcakearmy/autorestic \\
|
||||||
autorestic backup -va
|
autorestic backup -va -c /data/.autorestic.yaml
|
||||||
```
|
```
|
||||||
|
|
||||||
## Rclone
|
## Rclone
|
||||||
|
@@ -16,7 +16,7 @@ import (
|
|||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
)
|
)
|
||||||
|
|
||||||
const VERSION = "1.5.1"
|
const VERSION = "1.5.3"
|
||||||
|
|
||||||
var CI bool = false
|
var CI bool = false
|
||||||
var VERBOSE bool = false
|
var VERBOSE bool = false
|
||||||
@@ -63,7 +63,12 @@ func GetConfig() *Config {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return
|
cfgFileName := ".autorestic"
|
||||||
|
colors.Error.Println(
|
||||||
|
fmt.Sprintf(
|
||||||
|
"cannot find configuration file '%s.yml' or '%s.yaml'.",
|
||||||
|
cfgFileName, cfgFileName))
|
||||||
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
var versionConfig interface{}
|
var versionConfig interface{}
|
||||||
@@ -259,7 +264,7 @@ func (c *Config) SaveConfig() error {
|
|||||||
if err := CopyFile(file, file+".old"); err != nil {
|
if err := CopyFile(file, file+".old"); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
colors.Secondary.Println("Saved a backup copy of your file next the the original.")
|
colors.Secondary.Println("Saved a backup copy of your file next to the original.")
|
||||||
|
|
||||||
viper.Set("backends", c.Backends)
|
viper.Set("backends", c.Backends)
|
||||||
viper.Set("locations", c.Locations)
|
viper.Set("locations", c.Locations)
|
||||||
|
@@ -60,13 +60,13 @@ func ExecuteResticCommand(options ExecuteOptions, args ...string) (string, error
|
|||||||
}
|
}
|
||||||
|
|
||||||
func CopyFile(from, to string) error {
|
func CopyFile(from, to string) error {
|
||||||
original, err := os.Open("original.txt")
|
original, err := os.Open(from)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
defer original.Close()
|
defer original.Close()
|
||||||
|
|
||||||
new, err := os.Create("new.txt")
|
new, err := os.Create(to)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user