1
0

duplicate.go 456 B

1234567891011121314151617181920212223
  1. package stream
  2. import (
  3. "github.com/0xJacky/Nginx-UI/internal/helper"
  4. "github.com/0xJacky/Nginx-UI/internal/nginx"
  5. )
  6. // Duplicate duplicates a site by copying the file
  7. func Duplicate(src, dst string) (err error) {
  8. src = nginx.GetConfPath("streams-available", src)
  9. dst = nginx.GetConfPath("streams-available", dst)
  10. if helper.FileExists(dst) {
  11. return ErrDstFileExists
  12. }
  13. _, err = helper.CopyFile(src, dst)
  14. if err != nil {
  15. return
  16. }
  17. return
  18. }