Skip to content

Commit e14cad7

Browse files
mrsdizzietechknowlogick
authored andcommitted
Include custom configuration file in dump (#6516)
When running the dump command, include the specific configuration file provided as part of the backup. Currently we only zip up custom/ and this misses the config file if it is somewhere else, like /etc/gitea/app.ini Fixes #6034
1 parent d8802b1 commit e14cad7

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

cmd/dump.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,14 @@ func runDump(ctx *cli.Context) error {
125125
if err := z.AddFile("gitea-db.sql", dbDump); err != nil {
126126
log.Fatalf("Failed to include gitea-db.sql: %v", err)
127127
}
128+
129+
if len(setting.CustomConf) > 0 {
130+
log.Printf("Adding custom configuration file from %s", setting.CustomConf)
131+
if err := z.AddFile("app.ini", setting.CustomConf); err != nil {
132+
log.Fatalf("Failed to include specified app.ini: %v", err)
133+
}
134+
}
135+
128136
customDir, err := os.Stat(setting.CustomPath)
129137
if err == nil && customDir.IsDir() {
130138
if err := z.AddDir("custom", setting.CustomPath); err != nil {

docs/content/doc/usage/backup-and-restore.en-us.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ directory. There should be some output similar to the following:
3434

3535
Inside the `gitea-dump-1482906742.zip` file, will be the following:
3636

37+
* `app.ini` - Optional copy of configuration file if originally stored outside of the default `custom/` directory
3738
* `custom` - All config or customerize files in `custom/`.
3839
* `data` - Data directory in <GITEA_WORK_DIR>, except sessions if you are using file session. This directory includes `attachments`, `avatars`, `lfs`, `indexers`, sqlite file if you are using sqlite.
3940
* `gitea-db.sql` - SQL dump of database
@@ -53,7 +54,7 @@ Example:
5354
apt-get install gitea
5455
unzip gitea-dump-1482906742.zip
5556
cd gitea-dump-1482906742
56-
mv custom/conf/app.ini /etc/gitea/conf/app.ini
57+
mv custom/conf/app.ini /etc/gitea/conf/app.ini # or mv app.ini /etc/gitea/conf/app.ini
5758
unzip gitea-repo.zip
5859
mv gitea-repo/* /var/lib/gitea/repositories/
5960
chown -R gitea:gitea /etc/gitea/conf/app.ini /var/lib/gitea/repositories/

0 commit comments

Comments
 (0)