soyprano/soyprano.scm
2025-04-09 15:06:47 +02:00

32 lines
1.3 KiB
Scheme
Executable file

#!/usr/bin/env guile --no-auto-compile
!#
;; Copyright (C) 2024 Skylar Astaroth <cobra@vern.cc>
;; Copyright (C) 2025 Clombrong <don't contact me>
;;
;; This file is part of Soyprano
;;
;; Soyprano is free software: you can redistribute it and/or modify it under the
;; terms of the GNU Affero General Public License as published by the Free
;; Software Foundation, either version 3 of the License, or (at your option) any
;; later version.
;;
;; This program is distributed in the hope that it will be useful, but WITHOUT
;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
;; for more details.
;;
;; You should have received a copy of the GNU Affero General Public License
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
(define-module (soyprano)
#:use-module (soyprano server)
#:use-module (web server))
(let ((port (if (getenv "SOYPRANO_PORT")
(string->number (getenv "SOYPRANO_PORT"))
8080))
(sock (socket PF_INET SOCK_STREAM 0)))
(bind sock AF_INET INADDR_ANY port)
(fcntl sock F_SETFL (logior O_NONBLOCK
(fcntl sock F_GETFL)))
(run-server handler 'http `(#:socket ,sock)))