File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ Configuration is done via Environment Variables:
3737| CODEARTIFACT_DOMAIN | Yes | Your CodeArtifact Domain (e.g. sktansandbox) |
3838| CODEARTIFACT_TYPE | No | Use one of the following: pypi, npm, maven, nuget |
3939| CODEARTIFACT_OWNER | No | The AWS Account Id of the CodeArtifact Owner (if it's your own account, it can be empty) |
40+ | LISTEN_PORT | No | Port on which the proxy should listen. Defaults to 8080 |
4041
4142By default, the proxy will choose to use the Pypi as it's type.
4243
Original file line number Diff line number Diff line change 99 "net/http"
1010 "net/http/httputil"
1111 "net/url"
12+ "os"
1213 "strconv"
1314 "strings"
1415 "sync"
@@ -125,13 +126,23 @@ func ProxyInit() {
125126 panic (err )
126127 }
127128
129+ // Get port from LISTEN_PORT environment variable. If not set, default to 8080.
130+ port := getEnv ("LISTEN_PORT" , "8080" )
131+
128132 proxy := httputil .NewSingleHostReverseProxy (remote )
129133
130134 proxy .ModifyResponse = ProxyResponseHandler ()
131135
132136 http .HandleFunc ("/" , ProxyRequestHandler (proxy ))
133- err = http .ListenAndServe (":8080" , nil )
137+ err = http .ListenAndServe (":" + port , nil )
134138 if err != nil {
135139 panic (err )
136140 }
137141}
142+
143+ func getEnv (key , fallback string ) string {
144+ if value , ok := os .LookupEnv (key ); ok {
145+ return value
146+ }
147+ return fallback
148+ }
You can’t perform that action at this time.
0 commit comments