mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-07 06:40:54 +03:00
add support for build tag to allow to disable some features
The following build tags are available: - "nogcs", disable Google Cloud Storage backend - "nos3", disable S3 Compabible Object Storage backends - "nobolt", disable Bolt data provider - "nomysql", disable MySQL data provider - "nopgsql", disable PostgreSQL data provider - "nosqlite", disable SQLite data provider - "noportable", disable portable mode
This commit is contained in:
23
vfs/gcsfs.go
23
vfs/gcsfs.go
@@ -1,3 +1,5 @@
|
||||
// +build !nogcs
|
||||
|
||||
package vfs
|
||||
|
||||
import (
|
||||
@@ -19,6 +21,7 @@ import (
|
||||
|
||||
"github.com/drakkan/sftpgo/logger"
|
||||
"github.com/drakkan/sftpgo/metrics"
|
||||
"github.com/drakkan/sftpgo/utils"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -27,22 +30,6 @@ var (
|
||||
gcsDefaultFieldsSelection = []string{"Name", "Size", "Deleted", "Updated"}
|
||||
)
|
||||
|
||||
// GCSFsConfig defines the configuration for Google Cloud Storage based filesystem
|
||||
type GCSFsConfig struct {
|
||||
Bucket string `json:"bucket,omitempty"`
|
||||
// KeyPrefix is similar to a chroot directory for local filesystem.
|
||||
// If specified the SFTP user will only see objects that starts with
|
||||
// this prefix and so you can restrict access to a specific virtual
|
||||
// folder. The prefix, if not empty, must not start with "/" and must
|
||||
// end with "/".
|
||||
// If empty the whole bucket contents will be available
|
||||
KeyPrefix string `json:"key_prefix,omitempty"`
|
||||
CredentialFile string `json:"-"`
|
||||
Credentials string `json:"credentials,omitempty"`
|
||||
AutomaticCredentials int `json:"automatic_credentials,omitempty"`
|
||||
StorageClass string `json:"storage_class,omitempty"`
|
||||
}
|
||||
|
||||
// GCSFs is a Fs implementation for Google Cloud Storage.
|
||||
type GCSFs struct {
|
||||
connectionID string
|
||||
@@ -53,6 +40,10 @@ type GCSFs struct {
|
||||
ctxLongTimeout time.Duration
|
||||
}
|
||||
|
||||
func init() {
|
||||
utils.AddFeature("+gcs")
|
||||
}
|
||||
|
||||
// NewGCSFs returns an GCSFs object that allows to interact with Google Cloud Storage
|
||||
func NewGCSFs(connectionID, localTempDir string, config GCSFsConfig) (Fs, error) {
|
||||
var err error
|
||||
|
||||
Reference in New Issue
Block a user