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:
Nicola Murino
2020-05-23 11:58:05 +02:00
parent 15298b0409
commit ad53429cf1
26 changed files with 406 additions and 189 deletions

View File

@@ -1,3 +1,5 @@
// +build !nosqlite
package dataprovider
import (
@@ -6,6 +8,9 @@ import (
"path/filepath"
"strings"
// we import go-sqlite3 here to be able to disable SQLite support using a build tag
_ "github.com/mattn/go-sqlite3"
"github.com/drakkan/sftpgo/logger"
"github.com/drakkan/sftpgo/utils"
)
@@ -41,6 +46,10 @@ type SQLiteProvider struct {
dbHandle *sql.DB
}
func init() {
utils.AddFeature("+sqlite")
}
func initializeSQLiteProvider(basePath string) error {
var err error
var connectionString string