diff options
author | terminaldweller <devi@terminaldweller.com> | 2024-01-23 19:34:09 +0000 |
---|---|---|
committer | terminaldweller <devi@terminaldweller.com> | 2024-01-23 19:34:09 +0000 |
commit | 891fa79cbb91186f3bd2427485b6364fc8bf9a49 (patch) | |
tree | 51bf5f11a61d879968714de0ef8b49051700baba | |
parent | added a reverse proxy (diff) | |
download | sms-webhook-891fa79cbb91186f3bd2427485b6364fc8bf9a49.tar.gz sms-webhook-891fa79cbb91186f3bd2427485b6364fc8bf9a49.zip |
added a reverse proxy
Diffstat (limited to '')
-rw-r--r-- | main.go | 11 |
1 files changed, 5 insertions, 6 deletions
@@ -22,6 +22,7 @@ const ( redisDialTimeout = 5 redisReadTimeout = 10 redisWriteTimetout = 10 + reconnectTime = 30 ) type handlerWrapper struct { @@ -66,21 +67,18 @@ func (hw handlerWrapper) postHandler(context echo.Context) error { } for { - fmt.Println("one") - // irc = <-hw.irc if hw.irc != nil { if hw.irc.IsConnected() { break } } - fmt.Println("two") } hw.irc.Cmd.Message(hw.config.IrcChannel, fmt.Sprintf("From: %s, Text: %s", sms.From, sms.Text)) - fmt.Println(smsInfoReal) + log.Println(smsInfoReal) - return context.JSON(http.StatusOK, sms) + return context.JSON(http.StatusOK, "OK") } func runIRC(appConfig TomlConfig, ircChan chan *girc.Client) { @@ -96,6 +94,7 @@ func runIRC(appConfig TomlConfig, ircChan chan *girc.Client) { saslUser := appConfig.IrcSaslUser saslPass := appConfig.IrcSaslPass + if saslUser != "" && saslPass != "" { irc.Config.SASL = &girc.SASLPlain{ User: appConfig.IrcSaslUser, @@ -114,7 +113,7 @@ func runIRC(appConfig TomlConfig, ircChan chan *girc.Client) { if err := irc.Connect(); err != nil { log.Println(err) log.Println("reconnecting in 30 seconds") - time.Sleep(30 * time.Second) + time.Sleep(reconnectTime * time.Second) } else { return } |