mirror of
				https://github.com/1Panel-dev/1Panel.git
				synced 2025-10-31 03:07:34 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			48 lines
		
	
	
	
		
			1.3 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			48 lines
		
	
	
	
		
			1.3 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
| package v1
 | |
| 
 | |
| import (
 | |
| 	"github.com/1Panel-dev/1Panel/backend/app/api/v1/helper"
 | |
| 	"github.com/1Panel-dev/1Panel/backend/app/dto"
 | |
| 	"github.com/1Panel-dev/1Panel/backend/constant"
 | |
| 	"github.com/gin-gonic/gin"
 | |
| )
 | |
| 
 | |
| func (b *BaseApi) LoadDaemonJson(c *gin.Context) {
 | |
| 	conf, err := dockerService.LoadDockerConf()
 | |
| 	if err != nil {
 | |
| 		helper.ErrorWithDetail(c, constant.CodeErrInternalServer, constant.ErrTypeInternalServer, err)
 | |
| 		return
 | |
| 	}
 | |
| 
 | |
| 	helper.SuccessWithData(c, conf)
 | |
| }
 | |
| 
 | |
| func (b *BaseApi) UpdateDaemonJson(c *gin.Context) {
 | |
| 	var req dto.DaemonJsonConf
 | |
| 	if err := c.ShouldBindJSON(&req); err != nil {
 | |
| 		helper.ErrorWithDetail(c, constant.CodeErrBadRequest, constant.ErrTypeInvalidParams, err)
 | |
| 		return
 | |
| 	}
 | |
| 
 | |
| 	if err := dockerService.UpdateConf(req); err != nil {
 | |
| 		helper.ErrorWithDetail(c, constant.CodeErrInternalServer, constant.ErrTypeInternalServer, err)
 | |
| 		return
 | |
| 	}
 | |
| 
 | |
| 	helper.SuccessWithData(c, nil)
 | |
| }
 | |
| 
 | |
| func (b *BaseApi) UpdateDaemonJsonByFile(c *gin.Context) {
 | |
| 	var req dto.DaemonJsonUpdateByFile
 | |
| 	if err := c.ShouldBindJSON(&req); err != nil {
 | |
| 		helper.ErrorWithDetail(c, constant.CodeErrBadRequest, constant.ErrTypeInvalidParams, err)
 | |
| 		return
 | |
| 	}
 | |
| 
 | |
| 	if err := dockerService.UpdateConfByFile(req); err != nil {
 | |
| 		helper.ErrorWithDetail(c, constant.CodeErrInternalServer, constant.ErrTypeInternalServer, err)
 | |
| 		return
 | |
| 	}
 | |
| 
 | |
| 	helper.SuccessWithData(c, nil)
 | |
| }
 |