Skip to content

Commit

Permalink
adding the daemon and some fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
John Hilliard committed Oct 30, 2020
1 parent 7191596 commit e6a7912
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
13 changes: 13 additions & 0 deletions README.org
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,16 @@ some testing
#+BEGIN_SRC
socat - OPENSSL-connect:127.0.0.1:1965,verify=0
#+END_SRC


** Installation

#+begin_src
go build melchior.go
cp melchior /usr/local/bin/melchior
cp melchior-daemon.service /etc/systemd/system/melchior-daemon.service
chmod 664 /etc/systemd/system/melchior-daemon.service

sudo systemctl enable melchior-daemon
sudo systemctl start melchior-daemon
#+end_src
14 changes: 14 additions & 0 deletions melchior-daemon.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[Unit]
Description=Melchior

[Service]
Environment=MELCHIOR_TLS_CERT=/var/gemini/certs/jfh.me.crt
Environment=MELCHIOR_TLS_KEY=/var/gemini/certs/jfh.me.key
Environment=MELCHIOR_HOSTNAME=jfh.me
Environment=MELCHIOR_BIND_ADDR=:1965
Environment=MELCHIOR_ROOT_DIR=/var/gemini/root/

ExecStart=/usr/local/bin/melchior

[Install]
WantedBy=multi-user.target
4 changes: 3 additions & 1 deletion melchior.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,9 @@ func handle(conn net.Conn) error {
func reply(conn net.Conn, code int, message string) {
msg := fmt.Sprintf("%d %s\r\n", code, message)
_, err := conn.Write([]byte(msg))
log.Printf("There was an error writing to the connection: %s", err)
if err != nil {
log.Printf("There was an error writing to the connection: %s", err)
}
}

func fullResponse(conn net.Conn, meta string, body []byte) (int, error) {
Expand Down

0 comments on commit e6a7912

Please sign in to comment.