Skip to content

Commit

Permalink
Merge pull request #14 from rahearn/configure-port
Browse files Browse the repository at this point in the history
Enable configuration of PORT and SSL_PORT
  • Loading branch information
rhermanek committed Feb 24, 2023
2 parents bd31698 + cb69732 commit 96553c5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ RUN freshclam --quiet --no-dns

COPY entrypoint.sh /usr/bin/

EXPOSE 9000
EXPOSE 9443
ENV PORT=9000
ENV SSL_PORT=9443

ENV MAX_SCAN_SIZE=100M
ENV MAX_FILE_SIZE=25M
Expand All @@ -61,4 +61,4 @@ ENV PCRE_MATCHLIMIT=100000
ENV PCRE_RECMATCHLIMIT=2000
ENV SIGNATURE_CHECKS=2

ENTRYPOINT [ "entrypoint.sh" ]
ENTRYPOINT [ "entrypoint.sh" ]
9 changes: 2 additions & 7 deletions clamrest.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,11 +193,6 @@ func waitForClamD(port string, times int) {

func main() {

const (
PORT = ":9000"
SSL_PORT = ":9443"
)

opts = make(map[string]string)

// https://github.com/prometheus/client_golang/blob/main/examples/gocollector/main.go
Expand Down Expand Up @@ -236,8 +231,8 @@ func main() {
))

// Start the HTTPS server in a goroutine
go http.ListenAndServeTLS(SSL_PORT, "/etc/ssl/clamav-rest/server.crt", "/etc/ssl/clamav-rest/server.key", nil)
go http.ListenAndServeTLS(fmt.Sprintf(":%s", opts["SSL_PORT"]), "/etc/ssl/clamav-rest/server.crt", "/etc/ssl/clamav-rest/server.key", nil)

// Start the HTTP server
http.ListenAndServe(PORT, nil)
http.ListenAndServe(fmt.Sprintf(":%s", opts["PORT"]), nil)
}

0 comments on commit 96553c5

Please sign in to comment.