mirror of
https://github.com/aykhans/bsky-feedgen.git
synced 2025-06-01 19:07:34 +00:00
Merge pull request #8 from aykhans/feat/add-versions
Add version variables
This commit is contained in:
commit
35907380fb
60
Makefile
60
Makefile
@ -1,60 +0,0 @@
|
|||||||
# Equivalent Makefile for Taskfile.yaml
|
|
||||||
|
|
||||||
.PHONY: ftl fmt tidy lint run-consumer run-feedgen-az run-api run-manager generate-env
|
|
||||||
|
|
||||||
# Default value for ARGS if not provided on the command line
|
|
||||||
ARGS ?=
|
|
||||||
|
|
||||||
# Runs fmt, tidy, and lint sequentially
|
|
||||||
ftl:
|
|
||||||
$(MAKE) fmt
|
|
||||||
$(MAKE) tidy
|
|
||||||
$(MAKE) lint
|
|
||||||
|
|
||||||
# Format Go code
|
|
||||||
fmt:
|
|
||||||
gofmt -w -d .
|
|
||||||
|
|
||||||
# Tidy Go modules
|
|
||||||
tidy:
|
|
||||||
go mod tidy
|
|
||||||
|
|
||||||
# Run golangci-lint
|
|
||||||
lint:
|
|
||||||
golangci-lint run
|
|
||||||
|
|
||||||
# Run the consumer application, loading environment from dotenv files
|
|
||||||
run-consumer:
|
|
||||||
set -a; \
|
|
||||||
. config/app/.consumer.env; \
|
|
||||||
. config/app/.mongodb.env; \
|
|
||||||
set +a; \
|
|
||||||
go run cmd/consumer/main.go $(ARGS)
|
|
||||||
|
|
||||||
# Run the feedgen-az application, loading environment from dotenv files
|
|
||||||
run-feedgen-az:
|
|
||||||
set -a; \
|
|
||||||
. config/app/feedgen/.az.env; \
|
|
||||||
. config/app/.mongodb.env; \
|
|
||||||
set +a; \
|
|
||||||
go run cmd/feedgen/az/main.go $(ARGS)
|
|
||||||
|
|
||||||
# Run the api application, loading environment from dotenv files
|
|
||||||
run-api:
|
|
||||||
set -a; \
|
|
||||||
. config/app/.api.env; \
|
|
||||||
. config/app/.mongodb.env; \
|
|
||||||
set +a; \
|
|
||||||
go run cmd/api/main.go
|
|
||||||
|
|
||||||
# Run the manager application with arguments (no dotenv)
|
|
||||||
run-manager:
|
|
||||||
go run cmd/manager/main.go $(ARGS)
|
|
||||||
|
|
||||||
# Generate env files from templates
|
|
||||||
generate-env:
|
|
||||||
cp config/app/consumer.env.example config/app/.consumer.env
|
|
||||||
cp config/app/api.env.example config/app/.api.env
|
|
||||||
cp config/app/mongodb.env.example config/app/.mongodb.env
|
|
||||||
cp config/app/feedgen/az.env.example config/app/feedgen/.az.env
|
|
||||||
cp config/mongodb/env.example config/mongodb/.env
|
|
55
Taskfile.yml
55
Taskfile.yml
@ -2,6 +2,9 @@
|
|||||||
|
|
||||||
version: "3"
|
version: "3"
|
||||||
|
|
||||||
|
vars:
|
||||||
|
DOCKER_REGISTRY: "git.aykhans.me/bsky/"
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
ftl:
|
ftl:
|
||||||
cmds:
|
cmds:
|
||||||
@ -16,19 +19,19 @@ tasks:
|
|||||||
lint: golangci-lint run
|
lint: golangci-lint run
|
||||||
|
|
||||||
run-consumer:
|
run-consumer:
|
||||||
cmd: go run cmd/consumer/main.go {{.CLI_ARGS}}
|
cmd: go run ./cmd/consumer {{.CLI_ARGS}}
|
||||||
dotenv:
|
dotenv:
|
||||||
- config/app/.consumer.env
|
- config/app/.consumer.env
|
||||||
- config/app/.mongodb.env
|
- config/app/.mongodb.env
|
||||||
|
|
||||||
run-feedgen-az:
|
run-feedgen-az:
|
||||||
cmd: go run cmd/feedgen/az/main.go {{.CLI_ARGS}}
|
cmd: go run ./cmd/feedgen/az {{.CLI_ARGS}}
|
||||||
dotenv:
|
dotenv:
|
||||||
- config/app/feedgen/.az.env
|
- config/app/feedgen/.az.env
|
||||||
- config/app/.mongodb.env
|
- config/app/.mongodb.env
|
||||||
|
|
||||||
run-api:
|
run-api:
|
||||||
cmd: go run cmd/api/main.go
|
cmd: go run ./cmd/api {{.CLI_ARGS}}
|
||||||
dotenv:
|
dotenv:
|
||||||
- config/app/.api.env
|
- config/app/.api.env
|
||||||
- config/app/.mongodb.env
|
- config/app/.mongodb.env
|
||||||
@ -55,21 +58,55 @@ tasks:
|
|||||||
|
|
||||||
docker-publish-api:
|
docker-publish-api:
|
||||||
desc: Publish docker image for api service
|
desc: Publish docker image for api service
|
||||||
|
vars:
|
||||||
|
GO_VERSION_FILE: ./cmd/api/version.go
|
||||||
|
IMAGE_NAME: feedgen-api
|
||||||
|
VERSION:
|
||||||
|
sh: grep -o 'const version = "[^"]*"' {{.GO_VERSION_FILE}} | grep -o '"[^"]*"' | tr -d '"'
|
||||||
|
VERSIONED_IMAGE: "{{.DOCKER_REGISTRY}}{{.IMAGE_NAME}}:{{.VERSION}}"
|
||||||
|
LATEST_IMAGE: "{{.DOCKER_REGISTRY}}{{.IMAGE_NAME}}:latest"
|
||||||
|
preconditions:
|
||||||
|
- test -f {{.GO_VERSION_FILE}}
|
||||||
|
- sh: '[ -n "{{.VERSION}}" ]'
|
||||||
|
msg: "Could not extract version from {{.GO_FILE}}"
|
||||||
cmds:
|
cmds:
|
||||||
- docker build -t git.aykhans.me/bsky/feedgen-api:latest -f ./cmd/api/Dockerfile .
|
- docker build -t {{.VERSIONED_IMAGE}} -f ./cmd/api/Dockerfile .
|
||||||
- docker push git.aykhans.me/bsky/feedgen-api:latest
|
- docker tag {{.VERSIONED_IMAGE}} {{.LATEST_IMAGE}}
|
||||||
|
- docker push {{.VERSIONED_IMAGE}}
|
||||||
|
- docker push {{.LATEST_IMAGE}}
|
||||||
|
- echo "Published {{.VERSIONED_IMAGE}} and {{.LATEST_IMAGE}}"
|
||||||
|
|
||||||
docker-publish-consumer:
|
docker-publish-consumer:
|
||||||
desc: Publish docker image for consumer service
|
desc: Publish docker image for consumer service
|
||||||
|
vars:
|
||||||
|
GO_VERSION_FILE: ./cmd/consumer/version.go
|
||||||
|
IMAGE_NAME: feedgen-consumer
|
||||||
|
VERSION:
|
||||||
|
sh: grep -o 'const version = "[^"]*"' {{.GO_VERSION_FILE}} | grep -o '"[^"]*"' | tr -d '"'
|
||||||
|
VERSIONED_IMAGE: "{{.DOCKER_REGISTRY}}{{.IMAGE_NAME}}:{{.VERSION}}"
|
||||||
|
LATEST_IMAGE: "{{.DOCKER_REGISTRY}}{{.IMAGE_NAME}}:latest"
|
||||||
cmds:
|
cmds:
|
||||||
- docker build -t git.aykhans.me/bsky/feedgen-consumer:latest -f ./cmd/consumer/Dockerfile .
|
- docker build -t {{.VERSIONED_IMAGE}} -f ./cmd/consumer/Dockerfile .
|
||||||
- docker push git.aykhans.me/bsky/feedgen-consumer:latest
|
- docker push {{.VERSIONED_IMAGE}}
|
||||||
|
- docker tag {{.VERSIONED_IMAGE}} {{.LATEST_IMAGE}}
|
||||||
|
- docker push {{.LATEST_IMAGE}}
|
||||||
|
- echo "Published {{.VERSIONED_IMAGE}} and {{.LATEST_IMAGE}}"
|
||||||
|
|
||||||
docker-publish-feedgen-az:
|
docker-publish-feedgen-az:
|
||||||
desc: Publish docker image for feedgen-az service
|
desc: Publish docker image for feedgen-az service
|
||||||
|
vars:
|
||||||
|
GO_VERSION_FILE: ./cmd/feedgen/az/version.go
|
||||||
|
IMAGE_NAME: feedgen-generator-az
|
||||||
|
VERSION:
|
||||||
|
sh: grep -o 'const version = "[^"]*"' {{.GO_VERSION_FILE}} | grep -o '"[^"]*"' | tr -d '"'
|
||||||
|
VERSIONED_IMAGE: "{{.DOCKER_REGISTRY}}{{.IMAGE_NAME}}:{{.VERSION}}"
|
||||||
|
LATEST_IMAGE: "{{.DOCKER_REGISTRY}}{{.IMAGE_NAME}}:latest"
|
||||||
cmds:
|
cmds:
|
||||||
- docker build -t git.aykhans.me/bsky/feedgen-generator-az:latest -f ./cmd/feedgen/az/Dockerfile .
|
- docker build -t {{.VERSIONED_IMAGE}} -f ./cmd/feedgen/az/Dockerfile .
|
||||||
- docker push git.aykhans.me/bsky/feedgen-generator-az:latest
|
- docker push {{.VERSIONED_IMAGE}}
|
||||||
|
- docker tag {{.VERSIONED_IMAGE}} {{.LATEST_IMAGE}}
|
||||||
|
- docker push {{.LATEST_IMAGE}}
|
||||||
|
- echo "Published {{.VERSIONED_IMAGE}} and {{.LATEST_IMAGE}}"
|
||||||
|
|
||||||
docker-publish-manager:
|
docker-publish-manager:
|
||||||
desc: Publish docker image for manager service
|
desc: Publish docker image for manager service
|
||||||
|
@ -6,7 +6,7 @@ COPY go.mod go.sum ./
|
|||||||
COPY ../../pkg ./pkg
|
COPY ../../pkg ./pkg
|
||||||
COPY ../../cmd/api ./cmd/api
|
COPY ../../cmd/api ./cmd/api
|
||||||
|
|
||||||
RUN CGO_ENABLED=0 go build -ldflags "-s -w" -o api ./cmd/api/main.go
|
RUN CGO_ENABLED=0 go build -ldflags "-s -w" -o api ./cmd/api
|
||||||
|
|
||||||
FROM gcr.io/distroless/static-debian12:latest
|
FROM gcr.io/distroless/static-debian12:latest
|
||||||
|
|
||||||
|
@ -2,8 +2,11 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"flag"
|
||||||
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
|
"strings"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
"github.com/aykhans/bsky-feedgen/pkg/api"
|
"github.com/aykhans/bsky-feedgen/pkg/api"
|
||||||
@ -15,11 +18,21 @@ import (
|
|||||||
_ "go.uber.org/automaxprocs"
|
_ "go.uber.org/automaxprocs"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type flags struct {
|
||||||
|
version bool
|
||||||
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
ctx, cancel := context.WithCancel(context.Background())
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
defer cancel()
|
defer cancel()
|
||||||
go listenForTermination(func() { cancel() })
|
go listenForTermination(func() { cancel() })
|
||||||
|
|
||||||
|
flags := getFlags()
|
||||||
|
if flags.version == true {
|
||||||
|
fmt.Printf("API version: %v\n", version)
|
||||||
|
os.Exit(0)
|
||||||
|
}
|
||||||
|
|
||||||
apiConfig, errMap := config.NewAPIConfig()
|
apiConfig, errMap := config.NewAPIConfig()
|
||||||
if errMap != nil {
|
if errMap != nil {
|
||||||
logger.Log.Error("API ENV error", "error", errMap.ToStringMap())
|
logger.Log.Error("API ENV error", "error", errMap.ToStringMap())
|
||||||
@ -59,3 +72,33 @@ func listenForTermination(do func()) {
|
|||||||
<-sigChan
|
<-sigChan
|
||||||
do()
|
do()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func getFlags() *flags {
|
||||||
|
flags := &flags{}
|
||||||
|
|
||||||
|
flag.Usage = func() {
|
||||||
|
fmt.Println(
|
||||||
|
`Usage:
|
||||||
|
|
||||||
|
consumer [flags]
|
||||||
|
|
||||||
|
Flags:
|
||||||
|
-version version information
|
||||||
|
-h, -help Display this help message`)
|
||||||
|
}
|
||||||
|
|
||||||
|
flag.BoolVar(&flags.version, "version", false, "print version information")
|
||||||
|
flag.Parse()
|
||||||
|
|
||||||
|
if args := flag.Args(); len(args) > 0 {
|
||||||
|
if len(args) == 1 {
|
||||||
|
fmt.Printf("unexpected argument: %s\n\n", args[0])
|
||||||
|
} else {
|
||||||
|
fmt.Printf("unexpected arguments: %v\n\n", strings.Join(args, ", "))
|
||||||
|
}
|
||||||
|
flag.CommandLine.Usage()
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
return flags
|
||||||
|
}
|
||||||
|
3
cmd/api/version.go
Normal file
3
cmd/api/version.go
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
const version = "0.1.0"
|
@ -6,7 +6,7 @@ COPY go.mod go.sum ./
|
|||||||
COPY ../../pkg ./pkg
|
COPY ../../pkg ./pkg
|
||||||
COPY ../../cmd/consumer ./cmd/consumer
|
COPY ../../cmd/consumer ./cmd/consumer
|
||||||
|
|
||||||
RUN CGO_ENABLED=0 go build -ldflags "-s -w" -o consumer ./cmd/consumer/main.go
|
RUN CGO_ENABLED=0 go build -ldflags "-s -w" -o consumer ./cmd/consumer
|
||||||
|
|
||||||
FROM gcr.io/distroless/static-debian12:latest
|
FROM gcr.io/distroless/static-debian12:latest
|
||||||
|
|
||||||
|
@ -20,42 +20,24 @@ import (
|
|||||||
_ "go.uber.org/automaxprocs"
|
_ "go.uber.org/automaxprocs"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type flags struct {
|
||||||
|
version bool
|
||||||
|
cursorOption types.ConsumerCursor
|
||||||
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
ctx, cancel := context.WithCancel(context.Background())
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
defer cancel()
|
defer cancel()
|
||||||
go listenForTermination(func() { cancel() })
|
go listenForTermination(func() { cancel() })
|
||||||
|
|
||||||
flag.Usage = func() {
|
flags := getFlags()
|
||||||
fmt.Println(
|
if flags.version == true {
|
||||||
`Usage:
|
fmt.Printf("Consumer version: %v\n", version)
|
||||||
|
os.Exit(0)
|
||||||
consumer [flags]
|
|
||||||
|
|
||||||
Flags:
|
|
||||||
-h, -help Display this help message
|
|
||||||
-cursor string Specify the starting point for data consumption (default: last-consumed)
|
|
||||||
Options:
|
|
||||||
last-consumed: Resume from the last processed data in storage
|
|
||||||
first-stream: Start from the beginning of the firehose
|
|
||||||
current-stream: Start from the current position in the firehose stream`)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var cursorOption types.ConsumerCursor
|
if flags.cursorOption == "" {
|
||||||
flag.Var(&cursorOption, "cursor", "")
|
_ = flags.cursorOption.Set("")
|
||||||
flag.Parse()
|
|
||||||
|
|
||||||
if args := flag.Args(); len(args) > 0 {
|
|
||||||
if len(args) == 1 {
|
|
||||||
fmt.Printf("unexpected argument: %s\n\n", args[0])
|
|
||||||
} else {
|
|
||||||
fmt.Printf("unexpected arguments: %v\n\n", strings.Join(args, ", "))
|
|
||||||
}
|
|
||||||
flag.CommandLine.Usage()
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
if cursorOption == "" {
|
|
||||||
_ = cursorOption.Set("")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
consumerConfig, errMap := config.NewConsumerConfig()
|
consumerConfig, errMap := config.NewConsumerConfig()
|
||||||
@ -89,7 +71,7 @@ Flags:
|
|||||||
ctx,
|
ctx,
|
||||||
postCollection,
|
postCollection,
|
||||||
"wss://bsky.network",
|
"wss://bsky.network",
|
||||||
cursorOption,
|
flags.cursorOption,
|
||||||
consumerConfig.PostMaxDate, // Save only posts created before PostMaxDate
|
consumerConfig.PostMaxDate, // Save only posts created before PostMaxDate
|
||||||
10*time.Second, // Save consumed data to MongoDB every 10 seconds
|
10*time.Second, // Save consumed data to MongoDB every 10 seconds
|
||||||
)
|
)
|
||||||
@ -121,3 +103,39 @@ func listenForTermination(do func()) {
|
|||||||
<-sigChan
|
<-sigChan
|
||||||
do()
|
do()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func getFlags() *flags {
|
||||||
|
flags := &flags{}
|
||||||
|
|
||||||
|
flag.Usage = func() {
|
||||||
|
fmt.Println(
|
||||||
|
`Usage:
|
||||||
|
|
||||||
|
consumer [flags]
|
||||||
|
|
||||||
|
Flags:
|
||||||
|
-version version information
|
||||||
|
-h, -help Display this help message
|
||||||
|
-cursor string Specify the starting point for data consumption (default: last-consumed)
|
||||||
|
Options:
|
||||||
|
last-consumed: Resume from the last processed data in storage
|
||||||
|
first-stream: Start from the beginning of the firehose
|
||||||
|
current-stream: Start from the current position in the firehose stream`)
|
||||||
|
}
|
||||||
|
|
||||||
|
flag.BoolVar(&flags.version, "version", false, "print version information")
|
||||||
|
flag.Var(&flags.cursorOption, "cursor", "Specify the starting point for data consumption")
|
||||||
|
flag.Parse()
|
||||||
|
|
||||||
|
if args := flag.Args(); len(args) > 0 {
|
||||||
|
if len(args) == 1 {
|
||||||
|
fmt.Printf("unexpected argument: %s\n\n", args[0])
|
||||||
|
} else {
|
||||||
|
fmt.Printf("unexpected arguments: %v\n\n", strings.Join(args, ", "))
|
||||||
|
}
|
||||||
|
flag.CommandLine.Usage()
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
return flags
|
||||||
|
}
|
||||||
|
3
cmd/consumer/version.go
Normal file
3
cmd/consumer/version.go
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
const version = "0.1.0"
|
@ -6,7 +6,7 @@ COPY go.mod go.sum ./
|
|||||||
COPY ../../pkg ./pkg
|
COPY ../../pkg ./pkg
|
||||||
COPY ../../cmd/feedgen/az ./cmd/feedgen/az
|
COPY ../../cmd/feedgen/az ./cmd/feedgen/az
|
||||||
|
|
||||||
RUN CGO_ENABLED=0 go build -ldflags "-s -w" -o feedgen ./cmd/feedgen/az/main.go
|
RUN CGO_ENABLED=0 go build -ldflags "-s -w" -o feedgen ./cmd/feedgen/az
|
||||||
|
|
||||||
FROM gcr.io/distroless/static-debian12:latest
|
FROM gcr.io/distroless/static-debian12:latest
|
||||||
|
|
||||||
|
@ -20,41 +20,24 @@ import (
|
|||||||
_ "go.uber.org/automaxprocs"
|
_ "go.uber.org/automaxprocs"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type flags struct {
|
||||||
|
version bool
|
||||||
|
cursorOption types.GeneratorCursor
|
||||||
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
ctx, cancel := context.WithCancel(context.Background())
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
defer cancel()
|
defer cancel()
|
||||||
go listenForTermination(func() { cancel() })
|
go listenForTermination(func() { cancel() })
|
||||||
|
|
||||||
flag.Usage = func() {
|
flags := getFlags()
|
||||||
fmt.Println(
|
if flags.version == true {
|
||||||
`Usage:
|
fmt.Printf("Feedgen Az version: %v\n", version)
|
||||||
|
os.Exit(0)
|
||||||
feedgen-az [flags]
|
|
||||||
|
|
||||||
Flags:
|
|
||||||
-h, -help Display this help message
|
|
||||||
-cursor string Specify the starting point for feed data generation (default: last-generated)
|
|
||||||
Options:
|
|
||||||
last-generated: Resume from the last generated data in storage
|
|
||||||
first-post: Start from the beginning of the posts`)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var cursorOption types.GeneratorCursor
|
if flags.cursorOption == "" {
|
||||||
flag.Var(&cursorOption, "cursor", "")
|
_ = flags.cursorOption.Set("")
|
||||||
flag.Parse()
|
|
||||||
|
|
||||||
if args := flag.Args(); len(args) > 0 {
|
|
||||||
if len(args) == 1 {
|
|
||||||
fmt.Printf("unexpected argument: %s\n\n", args[0])
|
|
||||||
} else {
|
|
||||||
fmt.Printf("unexpected arguments: %v\n\n", strings.Join(args, ", "))
|
|
||||||
}
|
|
||||||
flag.CommandLine.Usage()
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
if cursorOption == "" {
|
|
||||||
_ = cursorOption.Set("")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
feedGenAzConfig, errMap := config.NewFeedGenAzConfig()
|
feedGenAzConfig, errMap := config.NewFeedGenAzConfig()
|
||||||
@ -89,7 +72,7 @@ Flags:
|
|||||||
|
|
||||||
feedGeneratorAz := feedgenAz.NewGenerator(postCollection, feedAzCollection)
|
feedGeneratorAz := feedgenAz.NewGenerator(postCollection, feedAzCollection)
|
||||||
|
|
||||||
startCrons(ctx, feedGenAzConfig, feedGeneratorAz, feedAzCollection, cursorOption)
|
startCrons(ctx, feedGenAzConfig, feedGeneratorAz, feedAzCollection, flags.cursorOption)
|
||||||
logger.Log.Info("Cron jobs started")
|
logger.Log.Info("Cron jobs started")
|
||||||
|
|
||||||
<-ctx.Done()
|
<-ctx.Done()
|
||||||
@ -139,3 +122,38 @@ func listenForTermination(do func()) {
|
|||||||
<-sigChan
|
<-sigChan
|
||||||
do()
|
do()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func getFlags() *flags {
|
||||||
|
flags := &flags{}
|
||||||
|
|
||||||
|
flag.Usage = func() {
|
||||||
|
fmt.Println(
|
||||||
|
`Usage:
|
||||||
|
|
||||||
|
feedgen-az [flags]
|
||||||
|
|
||||||
|
Flags:
|
||||||
|
-version version information
|
||||||
|
-h, -help Display this help message
|
||||||
|
-cursor string Specify the starting point for feed data generation (default: last-generated)
|
||||||
|
Options:
|
||||||
|
last-generated: Resume from the last generated data in storage
|
||||||
|
first-post: Start from the beginning of the posts`)
|
||||||
|
}
|
||||||
|
|
||||||
|
flag.BoolVar(&flags.version, "version", false, "print version information")
|
||||||
|
flag.Var(&flags.cursorOption, "cursor", "Specify the starting point for feed data generation")
|
||||||
|
flag.Parse()
|
||||||
|
|
||||||
|
if args := flag.Args(); len(args) > 0 {
|
||||||
|
if len(args) == 1 {
|
||||||
|
fmt.Printf("unexpected argument: %s\n\n", args[0])
|
||||||
|
} else {
|
||||||
|
fmt.Printf("unexpected arguments: %v\n\n", strings.Join(args, ", "))
|
||||||
|
}
|
||||||
|
flag.CommandLine.Usage()
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
return flags
|
||||||
|
}
|
||||||
|
3
cmd/feedgen/az/version.go
Normal file
3
cmd/feedgen/az/version.go
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
const version = "0.1.0"
|
@ -5,7 +5,6 @@ package middleware
|
|||||||
import (
|
import (
|
||||||
"crypto"
|
"crypto"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
|
||||||
|
|
||||||
atcrypto "github.com/bluesky-social/indigo/atproto/crypto"
|
atcrypto "github.com/bluesky-social/indigo/atproto/crypto"
|
||||||
"github.com/golang-jwt/jwt/v5"
|
"github.com/golang-jwt/jwt/v5"
|
||||||
@ -44,7 +43,6 @@ func init() {
|
|||||||
jwt.RegisterSigningMethod(SigningMethodES256.Alg(), func() jwt.SigningMethod {
|
jwt.RegisterSigningMethod(SigningMethodES256.Alg(), func() jwt.SigningMethod {
|
||||||
return SigningMethodES256
|
return SigningMethodES256
|
||||||
})
|
})
|
||||||
fmt.Println("init Completed")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Errors returned on different problems.
|
// Errors returned on different problems.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user