Settings and configuration

Module is containing all necessary global variables for the package.

Module also has the ability to read user-defined data from two paths:

  • $HOME/_SETTINGS_PATH
  • /etc/_SETTINGS_PATH

See _SETTINGS_PATH for details.

Note

If the first path is found, other is ignored.

Example of the configuration file ($HOME/edeposit/ftp.json):

{
    "CONF_PATH": "/home/bystrousak/.ftpdconf/"
}

Attributes

ftp.settings.BASE_PATH = '/var/build/user_builds/edeposit-amqp-ftp/checkouts/latest/src/edeposit/amqp/ftp'

Module’s path.

ftp.settings.CONF_PATH = '/etc/proftpd/'

Proftpd configuration directory.

ftp.settings.LOG_PATH = '/var/log/proftpd/'

Proftpd log directory.

ftp.settings.DATA_PATH = '/home/ftp/'

Path to directory, where the user directories will be created.

ftp.settings.SERVER_ADDRESS = 'localhost'

Server’s address - used only in unit/integration testing.

ftp.settings.CONF_FILE = '/etc/proftpd/proftpd.conf'

Proftpd configuration file (in CONF_PATH directory).

ftp.settings.LOGIN_FILE = '/etc/proftpd/ftpd.passwd'

File where the login informations will be stored (CONF_PATH is used as dirname).

ftp.settings.LOG_FILE = '/var/log/proftpd/extended.log'

File where the extended logs are stored (LOG_PATH is used as dirname).

ftp.settings.LOCK_FILENAME = 'delete_me_to_import_files.txt'

Filename for the locking mechanism.

ftp.settings.USER_ERROR_LOG = 'error.log.txt'

Filename, where the error protocol is stored.

ftp.settings.USER_IMPORT_LOG = 'import.log.txt'

Filename, where the import protocol for the user is stored.

ftp.settings.LOCK_FILE_CONTENT = "Delete this file to start batch import of all files, you've uploaded to the server.\n\nSmazte tento soubor pro zapoceti davkoveho importu vsech souboru, ktere jste\nnahrali na server.\n"

Text, which will be writen to the PROTFPD_LOCK_FILENAME.

ftp.settings.SAME_NAME_DIR_PAIRING = True

True - will pair files with same filename in same directory

ftp.settings.SAME_DIR_PAIRING = True

True - will pair files with different filenames, if there is only two files in dir

ftp.settings.ISBN_PAIRING = True

True - if the name is ISBN, files will be paired no matter where they are stored (unless they weren’t paired before)

ftp.settings.LOCK_ONLY_IN_HOME = True

True - Lock file can be only in home directory, everywhere else will be ignored

ftp.settings.CREATE_IMPORT_LOG = True

True - USER_IMPORT_LOG will be created

ftp.settings.LEAVE_BAD_FILES = True

True - don’t remove badly formatted metadata files

ftp.settings.PROFTPD_USERS_GID = 2000

I am using GID 2000 for all our users - this GID shouldn’t be used by other than FTP users!

ftp.settings.conf_merger(user_dict, variable)[source]

Merge global configuration with user’s personal configuration.

Global configuration has always higher priority.

ftp.settings.get_all_constants()[source]

Get list of all uppercase, non-private globals (doesn’t start with _).

Returns:Uppercase names defined in globals() (variables from this module).
Return type:list
ftp.settings.substitute_globals(config_dict)[source]

Set global variables to values defined in config_dict.

Parameters:config_dict (dict) – dictionary with data, which are used to set globals.

Note

config_dict have to be dictionary, or it is ignored. Also all variables, that are not already in globals, or are not types defined in _ALLOWED (str, int, float) or starts with _ are silently ignored.