Pārlūkot izejas kodu

Attachment local cache path has been renamed from PathConfig to AttachmentCache in CRMConfig

master
Patrick Peng Sun pirms 8 gadiem
vecāks
revīzija
01e2f6ebe6
5 mainītis faili ar 9 papildinājumiem un 7 dzēšanām
  1. +3
    -2
      common_test.go
  2. +2
    -0
      configCRM.go
  3. +2
    -1
      crm_config.json
  4. +1
    -3
      main.go
  5. +1
    -1
      server.go

+ 3
- 2
common_test.go Parādīt failu

CRMConfig = EspoCRMAPIConfig{ CRMConfig = EspoCRMAPIConfig{
"https://c.hitxy.org.au/", "https://c.hitxy.org.au/",
"wechat", "wechat",
"crmwechat.api"}
GlobalPath = PathsConfig{"/tmp", "/tmp"}
"crmwechat.api",
"/tmp/"}
GlobalPath = PathsConfig{"/tmp"}
KFUsers.kfRenewList() KFUsers.kfRenewList()
} }



+ 2
- 0
configCRM.go Parādīt failu



//access Password //access Password
UserPass string `json:"UserPass"` UserPass string `json:"UserPass"`

AttachmentCache string `json:"AttachmentCache"`
} }


//CRMConfig contains secrets that cannot store in source file //CRMConfig contains secrets that cannot store in source file

+ 2
- 1
crm_config.json Parādīt failu

{ {
"BaseURL": "https://crm.hitxy.org.au/", "BaseURL": "https://crm.hitxy.org.au/",
"UserName": "wechat", "UserName": "wechat",
"UserPass": "crmwechat.api"
"UserPass": "crmwechat.api",
"AttachmentCache" : "/tmp/"
} }

+ 1
- 3
main.go Parādīt failu



//PathsConfig all system available pathes //PathsConfig all system available pathes
type PathsConfig struct { type PathsConfig struct {
CRMAttachment string `json:"crm_attachment"`
Angular2App string `json:"angular2_app"`
Angular2App string `json:"angular2_app"`
} }


//TODO: setup GlobalPath Config, from reading file //TODO: setup GlobalPath Config, from reading file
//GlobalPath all global pathes configurations //GlobalPath all global pathes configurations
var GlobalPath = PathsConfig{ var GlobalPath = PathsConfig{
"/tmp/",
"/mnt/data/workspace/angular.ts/wechat/ng2-admin/dist/"} "/mnt/data/workspace/angular.ts/wechat/ng2-admin/dist/"}


//KFUsers info cache about current customer service //KFUsers info cache about current customer service

+ 1
- 1
server.go Parādīt failu

//in this way, user has no 'direct-access' to the CRM server. //in this way, user has no 'direct-access' to the CRM server.
func crmAttachmentHandler(w http.ResponseWriter, r *http.Request) { func crmAttachmentHandler(w http.ResponseWriter, r *http.Request) {
fileID := getCrmFileID(r.URL.Path) fileID := getCrmFileID(r.URL.Path)
saveAs := GlobalPath.CRMAttachment + "crm_attach_" + fileID //add prefix for easy deleting
saveAs := CRMConfig.AttachmentCache + "crm_attach_" + fileID //add prefix for easy deleting
if isFileExist(saveAs) { if isFileExist(saveAs) {
http.ServeFile(w, r, saveAs) http.ServeFile(w, r, saveAs)
return return

Notiek ielāde…
Atcelt
Saglabāt