6 Commits
Author SHA1 Message Date
phoenix d6dcd826a9 Saving notify messages script 2026-06-06 14:20:14 -04:00
phoenix 44348ad393 Saving code 2026-06-06 14:19:23 -04:00
phoenixandphoenix 85059d3c23 update go (#18)
Go / build (pull_request) Failing after 6s
Reviewed-on: #18
Co-authored-by: phoenix <mail@kundeng.us>
Co-committed-by: phoenix <mail@kundeng.us>
2026-05-03 16:58:06 -04:00
phoenixandphoenix 6e7b2cdee8 Update go (#17)
Reviewed-on: #17
Co-authored-by: phoenix <mail@kundeng.us>
Co-committed-by: phoenix <mail@kundeng.us>
2026-04-04 21:54:30 -04:00
phoenixandphoenix 2a519e2883 Update packages (#16)
Reviewed-on: #16
Co-authored-by: phoenix <kundeng00@pm.me>
Co-committed-by: phoenix <kundeng00@pm.me>
2025-12-26 22:08:10 +00:00
phoenixandphoenix 2041e3e20b tsk-14: Update go (#15)
Closes #14

Reviewed-on: #15
Co-authored-by: phoenix <kundeng00@pm.me>
Co-committed-by: phoenix <kundeng00@pm.me>
2025-11-24 20:21:39 +00:00
13 changed files with 140 additions and 158 deletions
+3 -3
View File
@@ -14,9 +14,9 @@ jobs:
- uses: actions/checkout@v5
- name: Set up Go
uses: actions/setup-go@v4
uses: actions/setup-go@v6
with:
go-version: '1.25.3' # You can specify a specific version or 'stable'
go-version: '1.26.2' # You can specify a specific version or 'stable'
- name: Build
run: |
@@ -24,7 +24,7 @@ jobs:
mkdir -p ~/.ssh
echo "${{ secrets.MYREPO_TOKEN }}" > ~/.ssh/textsender_models_deploy_key
chmod 600 ~/.ssh/textsender_models_deploy_key
ssh-keyscan ${{ vars.MY_HOST }} >> ~/.ssh/known_hosts
ssh-keyscan ${{ secrets.MY_HOST }} >> ~/.ssh/known_hosts
eval $(ssh-agent -s)
ssh-add -v ~/.ssh/textsender_models_deploy_key
-36
View File
@@ -1,36 +0,0 @@
# This file is a template, and might need editing before it works on your project.
# You can copy and paste this template into a new `.gitlab-ci.yml` file.
# You should not add this template to an existing `.gitlab-ci.yml` file by using the `include:` keyword.
#
# To contribute improvements to CI/CD templates, please follow the Development guide at:
# https://docs.gitlab.com/ee/development/cicd/templates.html
# This specific template is located at:
# https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Go.gitlab-ci.yml
image: golang:1.25.3
stages:
- test
- build
# - deploy
format:
stage: test
script:
- go fmt $(go list ./... | grep -v /vendor/)
- go vet $(go list ./... | grep -v /vendor/)
- go test -race $(go list ./... | grep -v /vendor/)
compile:
stage: build
script:
- make build
artifacts:
paths:
- mybinaries
# deploy:
# stage: deploy
# script: echo "Define your deployment script!"
# environment: production
+9 -9
View File
@@ -6,16 +6,16 @@ GO_VERSION ?= $(shell go version | awk '{print $$3}')
.PHONY: build
build:
go build -ldflags="\
-X 'git.kundeng.us/phoenix/sender/version.Version=$(VERSION)' \
-X 'git.kundeng.us/phoenix/sender/version.BuildTime=$(BUILD_TIME)' \
-X 'git.kundeng.us/phoenix/sender/version.Commit=$(COMMIT)' \
-X 'git.kundeng.us/phoenix/sender/version.GoVersion=$(GO_VERSION)'" \
-o sender main.go
-X 'git.kundeng.us/phoenix/sender/internal/version.Version=$(VERSION)' \
-X 'git.kundeng.us/phoenix/sender/internal/version.BuildTime=$(BUILD_TIME)' \
-X 'git.kundeng.us/phoenix/sender/internal/version.Commit=$(COMMIT)' \
-X 'git.kundeng.us/phoenix/sender/internal/version.GoVersion=$(GO_VERSION)'" \
-o sender cmd/sender/main.go
.PHONY: install
install:
go install -ldflags="\
-X 'git.kundeng.us/phoenix/sender/version.Version=$(VERSION)' \
-X 'git.kundeng.us/phoenix/sender/version.BuildTime=$(BUILD_TIME)' \
-X 'git.kundeng.us/phoenix/sender/version.Commit=$(COMMIT)' \
-X 'git.kundeng.us/phoenix/sender/version.GoVersion=$(GO_VERSION)'"
-X 'git.kundeng.us/phoenix/sender/internal/version.Version=$(VERSION)' \
-X 'git.kundeng.us/phoenix/sender/internal/version.BuildTime=$(BUILD_TIME)' \
-X 'git.kundeng.us/phoenix/sender/internal/version.Commit=$(COMMIT)' \
-X 'git.kundeng.us/phoenix/sender/internal/version.GoVersion=$(GO_VERSION)'"
+15 -15
View File
@@ -2,12 +2,13 @@ package main
import (
"fmt"
"log"
"os"
"git.kundeng.us/phoenix/sender/config"
"git.kundeng.us/phoenix/sender/messaging"
"git.kundeng.us/phoenix/sender/util"
"git.kundeng.us/phoenix/sender/version"
"git.kundeng.us/phoenix/sender/internal/config"
"git.kundeng.us/phoenix/sender/internal/messaging"
"git.kundeng.us/phoenix/sender/internal/util"
"git.kundeng.us/phoenix/sender/internal/version"
)
func main() {
@@ -19,44 +20,43 @@ func main() {
fmt.Println(version.String())
return
} else if argCount < 4 {
fmt.Printf("Argument count: %v\n", argCount)
fmt.Println("Provide argument to config file and number file")
os.Exit(-1)
log.Printf("Argument count: %v\n", argCount)
log.Fatal("Provide argument to config file and number file")
}
configPath, numberPath, messagePath := util.GetPaths(myArgs)
fmt.Printf("Config file path: %s\n", configPath)
fmt.Println("Numbers file path:", numberPath)
fmt.Println("Message path:", messagePath)
log.Printf("Config file path: %s\n", configPath)
log.Println("Numbers file path:", numberPath)
log.Println("Message path:", messagePath)
cfg, _ := config.ParseConfig(configPath)
cfg.PrintConfig()
numbers, err := util.ParseNumbers(numberPath)
if err != nil {
fmt.Println("Error:", err)
log.Println("Error:", err)
return
}
prepMessage, err := util.ParseMessage(messagePath)
if err != nil {
fmt.Println("Error:", err)
log.Println("Error:", err)
return
}
if len(numbers) == 0 || prepMessage.Content == "" {
if len(numbers) == 0 {
fmt.Println("No numbers to send")
log.Println("No numbers to send")
os.Exit(-1)
} else {
fmt.Println("No message to send")
log.Println("No message to send")
os.Exit(-1)
}
}
fmt.Println("")
fmt.Println("Message:", prepMessage.Content)
log.Println("Message:", prepMessage.Content)
messaging.SendMessages(cfg, numbers, *prepMessage, 5)
}
+5 -5
View File
@@ -1,16 +1,16 @@
module git.kundeng.us/phoenix/sender
go 1.25.3
go 1.26.2
require (
git.kundeng.us/phoenix/swoosh v0.0.1-main-3a21426ae1-556
git.kundeng.us/phoenix/textsender-models v0.0.7-5-9bc1743bd9-556
git.kundeng.us/phoenix/swoosh v0.2.1
git.kundeng.us/phoenix/textsender-models v0.2.1
)
require (
github.com/golang-jwt/jwt/v5 v5.3.0 // indirect
github.com/golang-jwt/jwt/v5 v5.3.1 // indirect
github.com/golang/mock v1.6.0 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/twilio/twilio-go v1.28.6 // indirect
github.com/twilio/twilio-go v1.30.5 // indirect
)
+10 -21
View File
@@ -1,34 +1,25 @@
git.kundeng.us/phoenix/swoosh v0.0.1-main-3a21426ae1-556 h1:HkaufrT0yaZA0VYS/eItPb0MAErCfnzsIqFlZKaQPtw=
git.kundeng.us/phoenix/swoosh v0.0.1-main-3a21426ae1-556/go.mod h1:P47q3zXiy5FVKrm6liOk9/gdn/bsJoAu27gnKiAaZos=
git.kundeng.us/phoenix/textsender-models v0.0.7-5-9bc1743bd9-556 h1:/tIswN4wEFioG++uo25iBY1jPNdHjhH07l8Vh4qUDQo=
git.kundeng.us/phoenix/textsender-models v0.0.7-5-9bc1743bd9-556/go.mod h1:lx5MCnOgGgsdpwzrfi9uph5xmkeb6H8AuexUNGss2no=
github.com/beevik/etree v1.1.0/go.mod h1:r8Aw8JqVegEf0w2fDnATrX9VpkMcyFeM0FhwO62wh+A=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
git.kundeng.us/phoenix/swoosh v0.2.1 h1:mJ/zXBOqzi0YTrSm5kxvahzp2WH7lx4R3iIO0s9VFFI=
git.kundeng.us/phoenix/swoosh v0.2.1/go.mod h1:81XNzmTmDPuDPmXMUmKTLErNSKKBM+hsW5U60Lm78ww=
git.kundeng.us/phoenix/textsender-models v0.2.1 h1:21br4NF58aUFuCx8laKxC5RvZMl4GsSIaMX4bvf5plw=
git.kundeng.us/phoenix/textsender-models v0.2.1/go.mod h1:nu5QWy9o+spx/t9NFipaGmF5qiBJS/0QhxyCjoi3Z3E=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/golang-jwt/jwt/v5 v5.2.2/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk=
github.com/golang-jwt/jwt/v5 v5.3.0 h1:pv4AsKCKKZuqlgs5sUmn4x8UlGa0kEVt/puTpKx9vvo=
github.com/golang-jwt/jwt/v5 v5.3.0/go.mod h1:fxCRLWMO43lRc8nhHWY6LGqRcf+1gQWArsqaEUEa5bE=
github.com/golang-jwt/jwt/v5 v5.3.1 h1:kYf81DTWFe7t+1VvL7eS+jKFVWaUnK9cB1qbwn63YCY=
github.com/golang-jwt/jwt/v5 v5.3.1/go.mod h1:fxCRLWMO43lRc8nhHWY6LGqRcf+1gQWArsqaEUEa5bE=
github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc=
github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/localtunnel/go-localtunnel v0.0.0-20170326223115-8a804488f275 h1:IZycmTpoUtQK3PD60UYBwjaCUHUP7cML494ao9/O8+Q=
github.com/localtunnel/go-localtunnel v0.0.0-20170326223115-8a804488f275/go.mod h1:zt6UU74K6Z6oMOYJbJzYpYucqdcQwSMPBEdSvGiaUMw=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/twilio/twilio-go v1.28.6 h1:L/pikXkARmPOzF/gUMeZPP/Lu5mY/wA4XC7sRzS86W4=
github.com/twilio/twilio-go v1.28.6/go.mod h1:FpgNWMoD8CFnmukpKq9RNpUSGXC0BwnbeKZj2YHlIkw=
github.com/twilio/twilio-go v1.30.5 h1:hi6+2kMte29zrFBsw7VSSNtbF30GPMGz/4LRIUgXng8=
github.com/twilio/twilio-go v1.30.5/go.mod h1:QbitvbvtkV77Jn4BABAKVmxabYSjMyQG4tHey9gfPqg=
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
@@ -52,7 +43,5 @@ golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
@@ -3,10 +3,10 @@ package config
import (
"encoding/json"
"flag"
"fmt"
"log"
"os"
"git.kundeng.us/phoenix/textsender-models/pkg/config"
axlry "git.kundeng.us/phoenix/textsender-models/tx0/config/auxiliary"
)
const (
@@ -24,22 +24,21 @@ func IsVersionFlagPresent() bool {
}
}
func ParseConfig(filepath string) (config config.TwiloConfig, success bool) {
func ParseConfig(filepath string) (config axlry.TwilioConfig, success bool) {
content, err := os.ReadFile(filepath)
fmt.Println("Reading config file...")
fmt.Printf("%s\n", filepath)
log.Println("Reading config file...")
log.Println(filepath)
if err != nil {
fmt.Println("An error reading the file")
log.Println("An error reading the file")
return
}
err = json.Unmarshal(content, &config)
if err != nil {
fmt.Println("An error occurred")
log.Println("An error occurred")
return config, false
}
+60
View File
@@ -0,0 +1,60 @@
package messaging
import (
"encoding/json"
"fmt"
"log"
"time"
"git.kundeng.us/phoenix/swoosh/swoop/send"
cnfg "git.kundeng.us/phoenix/textsender-models/tx0/config/auxiliary"
"git.kundeng.us/phoenix/textsender-models/tx0/contact"
msg "git.kundeng.us/phoenix/textsender-models/tx0/message"
)
func SendMessages(config cnfg.TwilioConfig, numbers [](contact.Contact), message msg.Message, secondInterval int) {
log.Println("Sending message")
longSleepLimit := 5
count := 0
var snr send.MessageSender
snr.Config = &config
// 2026-04-24 12:00 ET
// 2026-04-25T16:00:00.000Z
// 2026-04-25T16:00:00.000Z
// inputSendTime := "2026-04-25T16:00:00.000Z"
// inputSendTime = "2026-04-25T15:12:00.000Z"
// inputSendTime := "2026-04-29T16:18:00.000Z"
inputSendTime := "2026-04-30T00:00:00.000Z"
sentTime, err := time.Parse(time.RFC3339, inputSendTime)
if err != nil {
fmt.Println("Error:", err)
return
}
for _, number := range numbers {
numberToSend := number
log.Println("Sending to: " + numberToSend.PhoneNumber)
if resp, _, err := snr.Send(message, number, &sentTime); err != nil {
log.Println("Error sending:", err)
} else {
if response, err := json.Marshal(*resp); err != nil {
log.Println("Error parsing:", err)
} else {
log.Println("Response:", string(response))
}
}
log.Println("Sleeping")
if count%longSleepLimit == 0 {
// sleep for X seconds
tme := 1 * time.Second
time.Sleep(tme)
} else {
time.Sleep(time.Second)
}
}
}
+7 -7
View File
@@ -2,11 +2,11 @@ package util
import (
"encoding/json"
"fmt"
"log"
"os"
"git.kundeng.us/phoenix/textsender-models/pkg/contact"
"git.kundeng.us/phoenix/textsender-models/pkg/message"
"git.kundeng.us/phoenix/textsender-models/tx0/contact"
"git.kundeng.us/phoenix/textsender-models/tx0/message"
)
func GetPaths(args []string) (configPath string, numberPath string, messagePath string) {
@@ -23,11 +23,11 @@ func ParseNumbers(filepath string) (numbers [](contact.Contact), err error) {
content, err := os.ReadFile(filepath)
if err != nil {
fmt.Println("An error occurred")
log.Println("An error occurred")
return numbers, err
} else {
if err = json.Unmarshal(content, &nmbrs); err != nil {
fmt.Println("An error occurred:", err)
log.Println("An error occurred:", err)
return numbers, err
} else {
return nmbrs, nil
@@ -42,14 +42,14 @@ func ParseMessage(filepath string) (*message.Message, error) {
content, err := os.ReadFile(filepath)
if err != nil {
fmt.Println("An error occurred")
log.Println("An error occurred")
return nil, err
}
err = json.Unmarshal(content, &msg)
if err != nil {
fmt.Println("An error occurred")
log.Println("An error occurred")
return nil, err
}
-45
View File
@@ -1,45 +0,0 @@
package messaging
import (
"encoding/json"
"fmt"
"time"
"git.kundeng.us/phoenix/swoosh/swoop/send"
cnfg "git.kundeng.us/phoenix/textsender-models/pkg/config"
"git.kundeng.us/phoenix/textsender-models/pkg/contact"
msg "git.kundeng.us/phoenix/textsender-models/pkg/message"
)
func SendMessages(config cnfg.TwiloConfig, numbers [](contact.Contact), message msg.Message, secondInterval int) {
fmt.Println("Sending message")
longSleepLimit := 5
count := 0
var snr send.MessageSender
snr.Config = config
for _, number := range numbers {
numberToSend := number
fmt.Println("Sending to: " + numberToSend.PhoneNumber)
if resp, err := snr.Send(message, number, nil); err != nil {
fmt.Println("Error sending:", err)
} else {
if response, err := json.Marshal(*resp); err != nil {
fmt.Println("Error parsing:", err)
} else {
fmt.Println("Response:", string(response))
}
}
if count%longSleepLimit == 0 {
// sleep for X seconds
tme := 1 * time.Second
time.Sleep(tme)
} else {
time.Sleep(time.Second)
}
}
}
-9
View File
@@ -1,9 +0,0 @@
package models
import (
cnfg "git.kundeng.us/phoenix/textsender-models/pkg/config"
)
func Init() cnfg.TwiloConfig {
return cnfg.TwiloConfig{}
}
+24
View File
@@ -0,0 +1,24 @@
#!/bin/bash
root_dir=`pwd`
echo "Root directory: $root_dir"
if [[ ! -d "$root_dir" ]]; then
echo "Root directory does not exist. Exiting"
exit
fi
config_path="config.json"
numbers_part="1"
numbers_path="numbers/numbers-notify-$numbers_part.json"
type_message="json"
messages_path="messages/message-notify-$numbers_part.json"
send_message="True"
echo "Changing directory to $root_dir"
cd $root_dir
./sender "$config_path" "$numbers_path" "$messages_path"
echo "Done"