- // Create xds-project.conf file
- // FIXME: move to folders.createUpdate func (but gin context needed)
- fld := s.mfolders.Get(newFld.ID)
- prjConfFile := (*fld).GetFullPath("xds-project.conf")
- if !common.Exists(prjConfFile) {
- fd, err := os.OpenFile(prjConfFile, os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0666)
- if err != nil {
- common.APIError(c, err.Error())
- return
- }
- fd.WriteString("# XDS project settings\n")
- fd.WriteString("export XDS_SERVER_URL=" + c.Request.Host + "\n")
- fd.WriteString("export XDS_PROJECT_ID=" + newFld.ID + "\n")
- if newFld.DefaultSdk == "" {
- sdks := s.sdks.GetAll()
- newFld.DefaultSdk = sdks[0].ID
- }
- fd.WriteString("export XDS_SDK_ID=" + newFld.DefaultSdk + "\n")
- fd.Close()
- }
-