Application configuration#

Configuration is achieved bu two means:

Cold configuration#

It contains basic and highly technical data. It is meant to be tweaked by a technician and requires a full reboot to be taken into account.

Default configuration is in config.py. Override paramteters should be in instance/config.py.

Most configuration variables can be set using eponym environment variables.

Cold configuration description#

Configuration for the Application

Base configuration is defined in /config.py, but this file should be modified only by developper. To deploy an application with specific parameters, use instance/config.py. WARNING: for production, some parameter MUST be modified (ADMINPWD, SECRET_KEY)

config.ACTIVITY_TYPES = {1: {'email': 'dev-collectives@cafannecy.fr', 'name': 'Ski et surf en station', 'short': 'ski_alpin', 'trigram': 'ASA'}, 2: {'email': 'dev-collectives@cafannecy.fr', 'name': 'Escalade', 'short': 'escalade', 'trigram': 'AES'}, 3: {'email': 'dev-collectives@cafannecy.fr', 'name': 'Ski de randonnée', 'short': 'ski_rando', 'trigram': 'ASM'}, 4: {'email': 'dev-collectives@cafannecy.fr', 'name': 'Trail', 'short': 'trail', 'trigram': 'ATRAIL'}, 5: {'email': 'dev-collectives@cafannecy.fr', 'name': 'Canyon', 'short': 'canyon', 'trigram': 'ACA'}, 6: {'email': 'dev-collectives@cafannecy.fr', 'name': 'Randonnée raquettes', 'short': 'raquette', 'trigram': 'ARR'}, 7: {'email': 'dev-collectives@cafannecy.fr', 'name': 'Snow de randonnée', 'short': 'snow_rando', 'trigram': 'ASUM'}, 8: {'email': 'dev-collectives@cafannecy.fr', 'name': 'Cascade de glace', 'short': 'cascade_glace', 'trigram': 'AAL'}, 9: {'email': 'dev-collectives@cafannecy.fr', 'name': 'Alpinisme', 'short': 'alpinisme', 'trigram': 'AAL'}, 10: {'email': 'dev-collectives@cafannecy.fr', 'name': 'Parapente', 'short': 'parapente', 'trigram': 'AVR'}, 11: {'email': 'dev-collectives@cafannecy.fr', 'name': 'Randonnée montagne', 'short': 'randonnee', 'trigram': 'ARP'}, 12: {'email': 'dev-collectives@cafannecy.fr', 'name': 'VTT', 'short': 'cyclisme', 'trigram': 'AVTT'}, 13: {'deprecated': True, 'name': 'Formation', 'short': 'formation', 'trigram': 'FOR'}, 14: {'deprecated': True, 'name': 'Soirée', 'order': 99, 'short': 'soiree', 'trigram': 'SCL'}, 15: {'deprecated': True, 'name': 'Non classé', 'order': 100, 'short': 'none', 'trigram': 'NCL'}, 16: {'email': 'dev-collectives@cafannecy.fr', 'name': 'Slackline', 'short': 'slackline', 'trigram': 'ASL'}, 17: {'email': 'dev-collectives@cafannecy.fr', 'name': 'Marche nordique', 'short': 'marche_nordique', 'trigram': 'ANW'}, 18: {'email': 'dev-collectives@cafannecy.fr', 'name': 'Ski de fond et rando nordique', 'short': 'ski_fond', 'trigram': 'ASF'}, 20: {'deprecated': True, 'name': 'Jeunes', 'short': 'jeune', 'trigram': 'AJAL'}, 21: {'deprecated': True, 'name': 'Randonnées lointaines', 'short': 'randonnees_lointaines', 'trigram': 'ARL'}, 22: {'email': 'dev-collectives@cafannecy.fr', 'name': 'Via ferrata', 'short': 'viaferrata', 'trigram': 'AVF'}, 23: {'email': 'dev-collectives@cafannecy.fr', 'name': 'Dry tooling', 'short': 'dry_tooling', 'trigram': 'ADRY'}, 24: {'email': 'dev-collectives@cafannecy.fr', 'name': 'Premier secours', 'short': 'premier_secours', 'trigram': 'APSC'}, 25: {'email': 'dev-collectives@cafannecy.fr', 'name': 'Neige Avalanche', 'short': 'neige_avalanche', 'trigram': 'AAV'}, 26: {'email': 'dev-collectives@cafannecy.fr', 'name': 'Spéléologie', 'short': 'speleo', 'trigram': 'ASP'}}#

List of activity type

Contains the list of activity type as a dictionnary. id is an int, value is a hash. short is the name of the icon. trigram is the activity id for accounting. email is the dedicated activity email

Type

dict

config.ADMINPWD = 'foobar2'#

Password for admin account

Will be set or reset at every application. Makes sure this is a secure password in production.

Can be set using environment variable.

Type

string

config.ALLOWED_EXTENSIONS = {'gif', 'jpeg', 'jpg', 'png'}#

Allowed extension for uploaded images

Type

array

config.CONFIGURATION_CACHE_TIME = 60#

Number of second a configuration item can be cached before requiring an update from DB.

Type

int

config.CSV_COLUMNS = {'altitude': {'description': 'Altitude du sommet (en m)', 'optional': 1, 'short_desc': 'Altitude (en m)', 'type': 'int'}, 'carte_IGN': {'description': 'Référence de la carte IGN', 'optional': 1, 'short_desc': 'Carte IGN', 'type': 'string'}, 'cotation': {'description': 'Cotation / difficulté de la collective', 'optional': 1, 'short_desc': 'Cotation', 'type': 'string'}, 'debut': {'description': 'Date de début de la collective au format jj/mm/yyyy hh:mm (ex: 31/12/2020 14:45)', 'short_desc': 'Date de début', 'type': 'datetime'}, 'debut_internet': {'default': '7j avant la date de début de la collective à 7h', 'description': "Date d'ouverture des inscriptions par internet de la collective au format jj/mm/yyyy hh:mm (ex: 31/12/2020 14:45)", 'optional': 1, 'short_desc': "Date d'ouverture des inscriptions par internet", 'type': 'datetime'}, 'denivele': {'description': 'Dénivelé total de la collective (en m)', 'optional': 1, 'short_desc': 'Dénivelé (en m)', 'type': 'string'}, 'distance': {'description': 'Distance totale de la collective (en km)', 'optional': 1, 'short_desc': 'Distance (en km)', 'type': 'string'}, 'fin': {'description': 'Date de fin de la collective au format jj/mm/yyyy hh:mm (ex: 31/12/2020 14:45)', 'short_desc': 'Date de fin', 'type': 'datetime'}, 'fin_internet': {'default': '1j avant la date de début de la collective à 18h', 'description': 'Date de fin des inscriptions par internet de la collective au format jj/mm/yyyy hh:mm (ex: 31/12/2020 14:45)', 'optional': 1, 'short_desc': 'Date de fin des inscriptions par internet', 'type': 'datetime'}, 'id_encadrant': {'description': "Numéro de licence de l'encadrant", 'short_desc': 'Numéro de licence', 'type': 'int'}, 'nom_encadrant': {'description': "Prénom et nom de l'encadrant", 'short_desc': 'Encadrant', 'type': 'string'}, 'observations': {'description': 'Observations et description de la collective', 'optional': 1, 'short_desc': 'Observations', 'type': 'string'}, 'parent': {'default': None, 'description': 'ID (nombre) de la collective parente', 'optional': 1, 'short_desc': 'Collective parente', 'type': 'int'}, 'places': {'default': 0, 'description': 'Nombre de places', 'optional': 1, 'short_desc': 'Nombre de places', 'type': 'int'}, 'places_internet': {'default': '0', 'description': 'Nombre de places par internet', 'optional': 1, 'short_desc': 'Nombre de places par internet', 'type': 'int'}, 'secteur': {'description': 'Secteur / massif de la collective (ex: Bornes / Aravis)', 'optional': 1, 'short_desc': 'Secteur', 'type': 'string'}, 'tag': {'default': None, 'description': 'Nom du tag à ajouter', 'optional': 1, 'short_desc': 'Tag de la collective', 'type': 'string'}, 'titre': {'description': 'Titre de la collective', 'short_desc': 'Titre de la collective', 'type': 'string'}}#

Dictionnary of columns to import from CSV files.

Ordered list of columns. Dictionnary keys will be used as variables during csv import and can be inserted in description using place holders.

Key is the column name. And for each column:

  • short_desc: is the human readable column name

  • description: is a long description of the column, to be used in a documentation

  • type: is the column value type (can be one of string, int or datetime)

  • optional: if set to 1, column value is optional

  • default: default value

Type

dict

config.DEFAULT_ONLINE_SLOTS = 0#

Default number of slots for online subscription to an event

Can be set using environment variable.

Type

int

config.EVENT_TYPES = {1: {'name': 'Collective', 'requires_activity': True, 'short': 'collective', 'terms_file': '{GUIDE_FILE}', 'terms_title': '{GUIDE_TITLE}'}, 2: {'license_types': ['J1', 'J2', 'E1', 'E2'], 'name': 'Jeunes', 'requires_activity': True, 'short': 'jeune', 'terms_file': '{GUIDE_FILE}', 'terms_title': '{GUIDE_TITLE}'}, 3: {'name': 'Formation', 'requires_activity': False, 'short': 'formation', 'terms_file': '{GUIDE_FILE}', 'terms_title': '{GUIDE_TITLE}'}, 4: {'name': 'Soirée', 'requires_activity': False, 'short': 'soiree', 'terms_file': '{GUIDE_FILE}', 'terms_title': '{GUIDE_TITLE}'}, 5: {'name': 'Randonnées lointaines', 'requires_activity': True, 'short': 'randonnees_lointaines', 'terms_file': '2021-09-12_Organisation_Randonnées_Lointaines.pdf', 'terms_title': "guide d'organisation des randonnées lointaines du Club Alpin Français d'Annecy"}, 6: {'name': 'Achat groupé', 'requires_activity': False, 'short': 'shopping'}, 7: {'name': 'Inscription en ligne', 'requires_activity': False, 'short': 'inscription', 'terms_file': '{GUIDE_FILE}', 'terms_title': '{GUIDE_TITLE}'}, 8: {'name': 'Accès libre', 'requires_activity': True, 'short': 'acces_libre', 'terms_file': '{GUIDE_FILE}', 'terms_title': '{GUIDE_TITLE}'}, 9: {'name': 'Entrainement', 'requires_activity': True, 'short': 'entrainement', 'terms_file': '{GUIDE_FILE}', 'terms_title': '{GUIDE_TITLE}'}, 10: {'name': 'Cours', 'requires_activity': True, 'short': 'cours', 'terms_file': '{GUIDE_FILE}', 'terms_title': '{GUIDE_TITLE}'}, 11: {'name': 'Bénévolat', 'requires_activity': False, 'short': 'benevolat', 'terms_file': '{GUIDE_FILE}', 'terms_title': '{GUIDE_TITLE}'}, 12: {'name': 'Famille', 'requires_activity': False, 'short': 'famille', 'terms_file': '{GUIDE_FILE}', 'terms_title': '{GUIDE_TITLE}'}}#

List of event types

Contains the list of event type as a dictionnary. id is an int, value is a hash. short is the name of the icon.

Type

dict

config.EXTRANET_DISABLE = None#

Use a connection to FFCAM server to activate accounts.

Usually set to False for tests which don’t have acces to FFCAM server such as github CI tests.

Type

boolean

config.EXTRANET_WSDL = 'https://extranet-clubalpin.com/app/soap/extranet_pro.wsdl'#

URL of WSDL to connect to FFCAM server

Can be set using environment variable.

Type

string

config.FAVICON = 'caf/favicon.ico'#

URL to the site favicon

Type

string

config.FLASK_DEBUG = None#

Whether debug mode is enabled.

See https://flask.palletsprojects.com/en/1.1.x/config/#DEBUG

Can be set using environment variable.

Type

boolean

config.FLASK_ENV = None#

What environment the app is running in.

See https://flask.palletsprojects.com/en/1.1.x/config/#ENV

Can be set using environment variable.

Type

string

config.LOGGING_CONFIGURATION = '/home/demo/collectives-flask2/logging.cfg'#

Logging configuration file path.

File syntax is described here: here

Type

string

config.MAX_CONTENT_LENGTH = 5242880#

Max size to upload files.

Note: this is a Flask setting that will make the server itself refuse to upload files larger than this

Type

int

config.MAX_FILE_SIZE_MESSAGE = 'Le fichier est trop gros pour être chargé sur le serveur\u202f: [size] Mo. (max 5.0 Mo)'#

Error message if uploaded file is too big.

This error message is only used in form validation on client. [size] is a placeholder which will be replaced by the actual size of the file.

Type

int

config.PAYLINE_DIRECTPAYMENT_WSDL = './collectives/utils/payline_directpayment.wsdl'#

Path to WDSL file describing Payline DirectPayment SOAP API

Can be set using environment variable.

Type

string

config.PAYLINE_WSDL = './collectives/utils/payline.wsdl'#

Path to WDSL file describing Payline WebPayment SOAP API

Can be set using environment variable.

Type

string

config.PAYMENTS_MAX_PRICE = 10000#

Maximum price in euros for a payment item

Type

int

config.REGISTRATION_CLOSING_DELTA_DAYS = 1#

Default number of days the online registration should end before the beginning of the event

Can be set using environment variable.

Type

int

config.REGISTRATION_CLOSING_HOUR = 18#

Default hour of the day the online registration should end before the beginning of the event

Can be set using environment variable.

Type

int

config.REGISTRATION_OPENING_DELTA_DAYS = 7#

Default number of days the online registration should start before the beginning of the event

Can be set using environment variable.

Type

int

config.REGISTRATION_OPENING_HOUR = 7#

Default hour of the day the online registration should start before the beginning of the event

Can be set using environment variable.

Type

int

config.SECRET_KEY = '\'@GU^CpusZ0G2"`=^QAt\rF]|(\''#

A secret key to securely sign the session cookie and other.

See https://flask.palletsprojects.com/en/1.1.x/config/#SECRET_KEY To generate a new secret key: >>> import random, string >>> “”.join([random.choice(string.printable) for _ in range(24)]) Secret key can also be set in instance/config.py

Can be set using environment variable.

Type

string

config.SQLALCHEMY_DATABASE_URI = 'sqlite:////home/demo/collectives-flask2/app.db'#

Database URL

Set URL for SQLAlchemy database. Can be sqlite: sqlite:///app.db or mysql: mysql+pymysql://username:password@localhost/db_name?charset=utf8mb4

NB: When using mysql, charset must be specified to allow UTF8 character in test field.

Can be set using environment variable.

Type

string

config.UPLOADED_AVATARS_DEST = '/home/demo/collectives-flask2/collectives/static/uploads/avatars'#

Folder path for uploaded user avatars.

config.UPLOADED_DOCUMENTS_DEST = '/home/demo/collectives-flask2/collectives/static/uploads/documents'#

Folder path for uploaded event documents.

Type

string

config.UPLOADED_IMGTYPEEQUIP_DEST = '/home/demo/collectives-flask2/collectives/static/uploads/typeEquipmentImg'#

Folder path for uploaded type images.

Type

string

config.UPLOADED_PHOTOS_DEST = '/home/demo/collectives-flask2/collectives/static/uploads'#

Folder path for uploaded event photos.

Type

string

config.UPLOADED_PRIVATE_DEST = '/home/demo/collectives-flask2/collectives/private_assets'#

Folder path for private technician data.

Type

string

config.UPLOADED_TECH_DEST = '/home/demo/collectives-flask2/collectives/static/uploads/tech'#

Folder path for technician data.

Type

string

config.XLSX_TEMPLATE = '/home/demo/collectives-flask2/collectives/templates/exported_event.xlsx'#

Path to Excel template.

Type

string

Hot configuration#

This configuration contains less technical data, such as login credentials to external third parties (extranet, SMTP), appereance, and naming. It is saved in database.

Default configuration is stored in collectives/configuration.yaml.

Configuration is modified on ‘/technician/configuration’ by a technician or an administrator.

Hot configuration types#

See collectives.models.configuration.ConfigurationTypeEnum