Small tweaks to configuration flow, Dockerfile for running as a container
This commit is contained in:
parent
26dc3fa6fc
commit
f66ce030cf
|
@ -0,0 +1,13 @@
|
||||||
|
FROM golang:1.22 as builder
|
||||||
|
|
||||||
|
WORKDIR /src
|
||||||
|
COPY . /src
|
||||||
|
RUN CGO_ENABLED=0 go build -o /hydroxide-push ./cmd/hydroxide-push/
|
||||||
|
|
||||||
|
FROM alpine:latest
|
||||||
|
VOLUME /data
|
||||||
|
COPY --from=builder /hydroxide-push /
|
||||||
|
ENV HOME=/data
|
||||||
|
WORKDIR /data
|
||||||
|
ENTRYPOINT ["/hydroxide-push"]
|
||||||
|
CMD ["notify"]
|
|
@ -1,8 +0,0 @@
|
||||||
FROM scratch
|
|
||||||
|
|
||||||
COPY hydroxide-push /
|
|
||||||
ENV HOME=/data
|
|
||||||
ENV HYDROXIDE_BRIDGE_PASS="supersecretpassword"
|
|
||||||
WORKDIR /data
|
|
||||||
ENTRYPOINT ["/hydroxide-push"]
|
|
||||||
CMD ["notify"]
|
|
|
@ -229,20 +229,30 @@ func main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
case "setup-ntfy":
|
case "setup-ntfy":
|
||||||
|
err = cfg.Read()
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println(err)
|
||||||
|
}
|
||||||
|
var new string
|
||||||
|
if cfg.URL != "" && cfg.Topic != "" {
|
||||||
|
fmt.Printf("Current push endpoint: %s\n", cfg.String())
|
||||||
|
new = "new "
|
||||||
|
}
|
||||||
scanner := bufio.NewScanner(os.Stdin)
|
scanner := bufio.NewScanner(os.Stdin)
|
||||||
fmt.Printf("Input push server URL (e.g. 'http://ntfy.sh') : ")
|
fmt.Printf("Input %spush server URL (e.g. 'http://ntfy.sh') : ", new)
|
||||||
scanner.Scan()
|
scanner.Scan()
|
||||||
cfg.URL = scanner.Text()
|
cfg.URL = scanner.Text()
|
||||||
scanner = bufio.NewScanner(os.Stdin)
|
scanner = bufio.NewScanner(os.Stdin)
|
||||||
fmt.Printf("Input push topic (e.g. my-proton-notifications)\nLeave blank to generate a random one: ")
|
fmt.Printf("Input push topic (e.g. my-proton-notifications): ")
|
||||||
scanner.Scan()
|
scanner.Scan()
|
||||||
cfg.Topic = scanner.Text()
|
cfg.Topic = scanner.Text()
|
||||||
fmt.Printf("Using URL %s\n", cfg.String())
|
fmt.Printf("Using URL %s\n", cfg.String())
|
||||||
err = cfg.Save()
|
err = cfg.Save()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
fmt.Println(err)
|
||||||
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
log.Println("Notification configuration saved")
|
fmt.Println("Notification configuration saved")
|
||||||
case "notify":
|
case "notify":
|
||||||
authManager := auth.NewManager(newClient)
|
authManager := auth.NewManager(newClient)
|
||||||
eventsManager := events.NewManager()
|
eventsManager := events.NewManager()
|
||||||
|
|
|
@ -87,7 +87,9 @@ func Login(cfg *NtfyConfig, be backend.Backend) {
|
||||||
log.Println("login first using " + executable + " auth <protonmail username>")
|
log.Println("login first using " + executable + " auth <protonmail username>")
|
||||||
log.Fatalln("then setup ntfy using " + executable + "setup-ntfy")
|
log.Fatalln("then setup ntfy using " + executable + "setup-ntfy")
|
||||||
}
|
}
|
||||||
|
if cfg.BridgePw == "" {
|
||||||
cfg.BridgePw = os.Getenv("HYDROXIDE_BRIDGE_PASSWORD")
|
cfg.BridgePw = os.Getenv("HYDROXIDE_BRIDGE_PASSWORD")
|
||||||
|
}
|
||||||
if cfg.BridgePw == "" {
|
if cfg.BridgePw == "" {
|
||||||
scanner := bufio.NewScanner(os.Stdin)
|
scanner := bufio.NewScanner(os.Stdin)
|
||||||
fmt.Printf("Bridge password: ")
|
fmt.Printf("Bridge password: ")
|
||||||
|
|
Loading…
Reference in New Issue