Small tweaks to configuration flow, Dockerfile for running as a container
This commit is contained in:
parent
d47246be6d
commit
6459bcbc5a
|
@ -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":
|
||||
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)
|
||||
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()
|
||||
cfg.URL = scanner.Text()
|
||||
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()
|
||||
cfg.Topic = scanner.Text()
|
||||
fmt.Printf("Using URL %s\n", cfg.String())
|
||||
err = cfg.Save()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
fmt.Println(err)
|
||||
os.Exit(1)
|
||||
}
|
||||
log.Println("Notification configuration saved")
|
||||
fmt.Println("Notification configuration saved")
|
||||
case "notify":
|
||||
authManager := auth.NewManager(newClient)
|
||||
eventsManager := events.NewManager()
|
||||
|
|
|
@ -87,7 +87,9 @@ func Login(cfg *NtfyConfig, be backend.Backend) {
|
|||
log.Println("login first using " + executable + " auth <protonmail username>")
|
||||
log.Fatalln("then setup ntfy using " + executable + "setup-ntfy")
|
||||
}
|
||||
cfg.BridgePw = os.Getenv("HYDROXIDE_BRIDGE_PASSWORD")
|
||||
if cfg.BridgePw == "" {
|
||||
cfg.BridgePw = os.Getenv("HYDROXIDE_BRIDGE_PASSWORD")
|
||||
}
|
||||
if cfg.BridgePw == "" {
|
||||
scanner := bufio.NewScanner(os.Stdin)
|
||||
fmt.Printf("Bridge password: ")
|
||||
|
|
Loading…
Reference in New Issue