Ver código fonte

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

master
Patrick Peng Sun 8 anos atrás
pai
commit
01e2f6ebe6
5 arquivos alterados com 9 adições e 7 exclusões
  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 Ver arquivo

@@ -29,8 +29,9 @@ func SetupConfig() {
CRMConfig = EspoCRMAPIConfig{
"https://c.hitxy.org.au/",
"wechat",
"crmwechat.api"}
GlobalPath = PathsConfig{"/tmp", "/tmp"}
"crmwechat.api",
"/tmp/"}
GlobalPath = PathsConfig{"/tmp"}
KFUsers.kfRenewList()
}


+ 2
- 0
configCRM.go Ver arquivo

@@ -18,6 +18,8 @@ type EspoCRMAPIConfig struct {

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

AttachmentCache string `json:"AttachmentCache"`
}

//CRMConfig contains secrets that cannot store in source file

+ 2
- 1
crm_config.json Ver arquivo

@@ -1,5 +1,6 @@
{
"BaseURL": "https://crm.hitxy.org.au/",
"UserName": "wechat",
"UserPass": "crmwechat.api"
"UserPass": "crmwechat.api",
"AttachmentCache" : "/tmp/"
}

+ 1
- 3
main.go Ver arquivo

@@ -10,14 +10,12 @@ import (

//PathsConfig all system available pathes
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
//GlobalPath all global pathes configurations
var GlobalPath = PathsConfig{
"/tmp/",
"/mnt/data/workspace/angular.ts/wechat/ng2-admin/dist/"}

//KFUsers info cache about current customer service

+ 1
- 1
server.go Ver arquivo

@@ -217,7 +217,7 @@ func uploadHandler(w http.ResponseWriter, r *http.Request) {
//in this way, user has no 'direct-access' to the CRM server.
func crmAttachmentHandler(w http.ResponseWriter, r *http.Request) {
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) {
http.ServeFile(w, r, saveAs)
return

Carregando…
Cancelar
Salvar