Documentation ¶
Overview ¶
Package gcp provides a storage driver to upload module files to a google cloud platform storage bucket.
Configuration ¶
Environment variables:
ATHENS_STORAGE_GCP_BUCKET // full name of storage bucket ATHENS_STORAGE_GCP_SA // path to json keyfile of a service account
Example:
Bash: export ATHENS_STORAGE_GCP_BUCKET="fancy-pony-33928.appspot.com" Fish: set -x ATHENS_STORAGE_GCP_BUCKET fancy-pony-339288.appspot.com
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
Storage implements the Saver interface (./pkg/storage).Saver
func New ¶
New returns a new Storage instance authenticated using the provided ClientOptions. The bucket name to be used will be loaded from the environment variable ATHENS_STORAGE_GCP_BUCKET.
The ClientOptions should provide permissions sufficient to create objects in google cloud storage for your project.
func (*Storage) Save ¶
func (s *Storage) Save(ctx context.Context, module, version string, mod []byte, zip io.Reader, info []byte) error
Save uploads the module .mod, .zip and .info files for a given version. It expects a context, which can be provided using context.Background from the standard library.
Please note the following limitations which will eventually be configurable:
All three uploads share a time out currently set to 300 seconds. After which all ongoing uploads will cancel.
Uploaded files are publicly accessable in the storage bucket as per an ACL rule.