[go-zero] go-zero Aliyun oss front end uploads files to go-zero API service and creates files in k8s pod and pushes them to Aliyun oss best practice

I. Overview

1. Problems & Ideas

Problem: It is no problem to upload the file locally and then push the file to the oss of aliyun,
but when it is deployed to k8s, there is a problem, and there is always an error that there is no permission to create
. configmap, and then modify the deployment and dockerfile in this way. In the end, it was found that the way of creating the file path of go was wrong, which also shows the rigor of docker's isolation.

2. Best practice

1, go-zero generation

1.1. The desc code is as follows:

    BaseInfo {
   
    
    
        // ContractFile
        ContractFile interface{
   
    
    } `form:"contractFile,optional"`
    }

Let me explain here:

  • Here we need to use form instead of json
  • We can define the type as interface{}

<

Guess you like

Origin blog.csdn.net/wanglei19891210/article/details/131641429