config

package
v1.0.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 30, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package config provides functions for setting the initial values of server parameters.

Index

Constants

View Source
const LogLevelVariable string = "LOG_LEVEL"

The name of the environment variable for the log level. Allowed values are from 0 to 6. See package "go_multi_log": https://pkg.go.dev/github.com/takecontrolsoft/go_multi_log/logger/levels#LogLevel

View Source
const LogPathVariable string = "LOG_PATH"

The name of the environment variable with the path for log files. This value should point to the directory where the log files to be stored. Absolute path is required in DOS or UNC format. Make sure the server process has read/write access to this location.

View Source
const MaxUploadFileSize int64 = 5 * 1024 * 1024 * 1024

The maximum stream size that is allowed to be uploaded to the server. The size is set to maximum 5GB.

View Source
const PortVariable = "SYNC_SERVER_PORT"

The name of the environment variable with TCP port number on witch the server can be reached.

View Source
const UploadPathVariable string = "SYNC_STORAGE_PATH"

The name of the environment variable with the storage path. This value should point to the directory where the uploaded files to be stored. Absolute path is required in DOS or UNC format. Make sure the server process has read/write access to this location.

Variables

View Source
var AdminUser, AdminPassword string

AdminUser and AdminPassword bootstrap the first user when the auth DB has no users. Set via SYNC_ADMIN_USER and SYNC_ADMIN_PASSWORD.

View Source
var AuthDBPath string

AuthDBPath is the path to the SQLite auth DB for users and sessions. Set via SYNC_AUTH_DB. If unset, defaults to auth.db next to the executable (BinDirectory).

View Source
var BinDirectory string

BinDirectory is the directory of the sync_server executable. Place exiftool and ffmpeg executables here so the server finds them.

View Source
var DocumentClassifierPath string

DocumentClassifierPath is the path to a Python script (.py) or executable that classifies an image as document vs photo. The server runs it asynchronously after sync with the image path as the only argument; stdout "document" -> move to Trash. Set via SYNC_DOCUMENT_CLASSIFIER_PATH. Example: scripts/document_classifier.py

View Source
var DocumentToTrashEnabled bool

DocumentToTrashEnabled, when true, moves document-like images to Trash. If DocumentClassifierPath is set, that Python/exe is run asynchronously after upload; otherwise a built-in heuristic is used. Set via SYNC_DOCUMENT_TO_TRASH=1.

View Source
var ErrStoragePathEmpty = errors.Errorf("Storage path is empty.")

An error for empty storage path.

View Source
var LogLevel levels.LogLevel

Global variable for log level

View Source
var LogPath string

Global variable for log directory path

View Source
var PortNumber int

Global variable for port number

View Source
var UploadDirectory string

Global variable for storage directory path

Functions

func ErrEnvVariableNotSet

func ErrEnvVariableNotSet(envVariableName string) *errors.Error

An error for not set value for an environment variable that is needed to run the sync server.

func ErrEnvVariableSetEmpty

func ErrEnvVariableSetEmpty(envVariableName string) *errors.Error

An error for empty value for an environment variable that is needed to run the sync server.

func ExiftoolBinary added in v1.0.7

func ExiftoolBinary() string

ExiftoolBinary returns the path to the exiftool executable (next to sync_server).

func FfmpegBinary added in v1.0.7

func FfmpegBinary() string

FfmpegBinary returns the path to the ffmpeg executable (next to sync_server).

func InitBinDirectory added in v1.0.7

func InitBinDirectory()

InitBinDirectory sets BinDirectory to the executable's directory and prepends it to PATH so exiftool and ffmpeg are found when next to sync_server.

func InitFromEnvVariables

func InitFromEnvVariables()

Initialize the variables UploadDirectory, PortNumber, LogPath and LogLevel from the environment variables UploadPathVariable, PortVariable, LogPathVariable and LogLevelVariable.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL