(bugfix) preserve saved global backup root in Django setup form
Fix the global config edit view so default initial values are only used when creating a new config, preventing saved backup_root values from being hidden by form defaults. Keep pobsync_home as an internal runtime setting instead of exposing it in the normal Django setup form. Mount a host backup directory into Docker at /backups and document POBSYNC_BACKUP_ROOT so backup_root behaves predictably in containers.
This commit is contained in:
@@ -51,7 +51,7 @@ def edit_global_config(request):
|
||||
messages.success(request, f"Global config saved for {saved_config.name}.")
|
||||
return redirect("dashboard")
|
||||
else:
|
||||
form = GlobalConfigForm(instance=global_config, initial=_default_global_initial())
|
||||
form = GlobalConfigForm(instance=global_config) if global_config else GlobalConfigForm(initial=_default_global_initial())
|
||||
|
||||
return render(
|
||||
request,
|
||||
@@ -235,8 +235,7 @@ def _default_schedule_initial() -> dict[str, object]:
|
||||
def _default_global_initial() -> dict[str, object]:
|
||||
return {
|
||||
"name": "default",
|
||||
"backup_root": "/opt/pobsync/backups",
|
||||
"pobsync_home": "/opt/pobsync",
|
||||
"backup_root": "/backups",
|
||||
"ssh_user": "root",
|
||||
"ssh_port": 22,
|
||||
"rsync_binary": "rsync",
|
||||
|
||||
Reference in New Issue
Block a user