소스 검색

fix: passing of the addr string

chore/proposed-structure
Blaz Smehov 1 개월 전
부모
커밋
e276d091f6
4개의 변경된 파일9개의 추가작업 그리고 7개의 파일을 삭제
  1. +2
    -0
      .gitignore
  2. +4
    -4
      cmd/presenSe/presense.go
  3. +2
    -2
      internal/pkg/config/config.go
  4. +1
    -1
      internal/pkg/httpserver/server.go

+ 2
- 0
.gitignore 파일 보기

@@ -19,5 +19,7 @@

copy_files/

presence.db
cmd/presenSe/presence.db
# Dependency directories (remove the comment below to include it)
# vendor/

+ 4
- 4
cmd/presenSe/presense.go 파일 보기

@@ -48,10 +48,10 @@ func main() {
Network: "tcp",
Address: cfg.MQTTHost,
ClientID: []byte(cfg.MQTTClientID),
UserName: nil,
Password: nil,
// UserName: []byte(cfg.MQTTUser),
// Password: []byte(cfg.MQTTPass),
// UserName: nil,
// Password: nil,
UserName: []byte(cfg.MQTTUser),
Password: []byte(cfg.MQTTPass),
})

if err != nil {


+ 2
- 2
internal/pkg/config/config.go 파일 보기

@@ -25,8 +25,8 @@ func Load() *Config {
HTTPAddr: getEnv("HTTP_HOST_PATH", "0.0.0.0:8080"),
WSAddr: getEnv("HTTPWS_HOST_PATH", "0.0.0.0:8088"),
MQTTHost: getEnv("MQTT_HOST", "localhost:1883"),
MQTTUser: getEnv("MQTT_USERNAME", "none"),
MQTTPass: getEnv("MQTT_PASSWORD", "none"),
MQTTUser: getEnv("MQTT_USERNAME", "chesnek"),
MQTTPass: getEnv("MQTT_PASSWORD", "chesnek"),
MQTTClientID: getEnv("MQTT_CLIENT_ID", "presence-detector"),
DBPath: getEnv("DB_PATH", "/data/conf/presence/presence.db"),
}


+ 1
- 1
internal/pkg/httpserver/server.go 파일 보기

@@ -72,7 +72,7 @@ func StartHTTPServer(addr string, ctx *model.AppContext) {
go handleMessages(ctx.Clients, &ctx.Broadcast)

go func() {
log.Fatal(http.ListenAndServe(*model.HTTPWSHostPathPtr, nil))
log.Fatal(http.ListenAndServe(addr, nil))
}()

http.ListenAndServe(addr, handlers.CORS(originsOk, headersOk, methodsOk)(r))


불러오는 중...
취소
저장