nginx_ui/nginx-ui-dev/internal/site/duplicate.go

24 lines
450 B
Go
Raw Normal View History

2025-03-04 19:28:12 +08:00
package site
import (
"github.com/0xJacky/Nginx-UI/internal/helper"
"github.com/0xJacky/Nginx-UI/internal/nginx"
)
// Duplicate duplicates a site by copying the file
func Duplicate(src, dst string) (err error) {
src = nginx.GetConfPath("sites-available", src)
dst = nginx.GetConfPath("sites-available", dst)
if helper.FileExists(dst) {
return ErrDstFileExists
}
_, err = helper.CopyFile(src, dst)
if err != nil {
return
}
return
}