To configure Go in a restricted environment, use the GOPROXY environment variable and the Athens module datastore and proxy.
Configuring Go to use a non-standard-registry
Athens is a Go module datastore and proxy with many configuration options. It can be configured to act only as a module datastore and not as a proxy. An administrator can upload their Go modules to the Athens datastore and have them available across their Go projects. If a project tries to access a Go module that is not in the Athens datastore, the Go build fails.
-
To work with Athens, configure the
GOPROXYenvironment variable in the devfile of your CLI container:components: - mountSources: true type: dockerimage alias: go-cli image: 'quay.io/eclipse/che-golang-1.12:7.7.0' ... - value: /tmp/.cache name: GOCACHE - value: 'http://your.athens.host' name: GOPROXY
Using self-signed certificates in Go projects
Internal artifact repositories often do not have a self-signed (SSL) certificate signed by an authority that is trusted by default. They are usually signed by an internal company authority or are self-signed. Configure your tools to accept these certificates.
Go uses certificates from a file defined in the SSL_CERT_FILE environment variable.
-
Obtain the certificate used by the Athens server in the Privacy-Enhanced Mail (PEM) format and place it in the
/projects/sslfile to make it accessible from all your containers. -
Right-click the project explorer and select Upload files to upload the
rootCA.crtcertificate file to your Eclipse Che workspace. -
Add the appropriate environment variables to your devfile:
components: - mountSources: true type: dockerimage alias: go-cli image: 'quay.io/eclipse/che-golang-1.12:7.7.0' ... - value: /tmp/.cache name: GOCACHE - value: 'http://your.athens.host' name: GOPROXY - value: 'on' name: GO111MODULE - value: '/projects/ssl/rootCA.crt' name: SSL_CERT_FILE