bottin

command module
v0.0.0-...-3c0d45f Latest Latest
Warning

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

Go to latest
Published: May 29, 2023 License: MIT Imports: 1 Imported by: 0

README

agecem/bottin

Bottin de la masse étudiante, codé en Go. (Migration d'une application legacy en php)

Permet d'utiliser et de (rudimentairement) mettre à jour une base de donnée (présentement uniquement sqlite3) de noms et de numéros étudiants.

Sert principalement à vérifier le statut de membre d'une personne en comparant avec son numéro étudiant du cégep.

Base pour les futures applications utilisant des bases de données similaires:

  • Scan de présence pour Assemblée Générale (agecem/bottin-ag)

  • Distribution d'Agendas en début de session (`agecem/bottin-agendas)

Inclue un Dockerfile pour déployer en tant que container.

Inclue un Makefile pour l'exécution de tâches communes.

Repo

agecem/bottin

Utilisation

# Voir les options de make
make help

# Bâtir localement une container image sur docker
make build

Flags

L'application utilise un module pour afficher de l'information sur les différents flags existants.

# Pour voir l'aide de l'application
bottin -h

Exemple de résultat:

Run the bottin server

Usage:
  bottin server [flags]

Flags:
      --db-sqlite-path string     Path to sqlite database (config: 'db.sqlite.path')
      --db-type string            Database type (config: 'db.type')
  -h, --help                      help for server
      --insert-batch-size int     The amount of inserts to do per batch (config: 'import.insert_batch_size') (default 500)
      --json-insert-path string   The location of a json file containing Membres to insert.
      --login-password string     The password to login to the web ui. (config: 'login.password') (default "bottin")
      --login-username string     The username to login to the web ui. (config: 'login.username') (default "bottin")
      --server-port int           The port on which the web application will server content (config: 'server.port') (default 1312)

Global Flags:
      --config string   config file (default is $HOME/.bottin.yaml)

Procédure avec docker-compose

Voir documentation de docker-compose

docker-compose -h

Démarrer container en mode detached

docker-compose up -d

Éteindre le container, sans toucher aux volumes

docker-compose down

Sur un container qui roule, utiliser docker-compose run pour mettre à jour la db (avec --json-insert-path ou éventuellement bottin import).

docker-compose run bottin bottin server --json-insert-path examples/membres-test.json --config /etc/bottin/bottin.yaml

Exemples

Sans viper
# Servir l'application sur le port 8080, en spécifiant les credentials à utiliser pour y accéder ainsi que le type et chemin d'accès d'une database.
bottin server --db-type 'sqlite' --db-sqlite-path '/chemin/vers/bottin-database.db' --login-username 'exemple' --login-password 'un_autre_mot_de_passe' --server-port 8080`

# Servir l'application en spécifiant le chemin d'accès d'une database (sqlite3 ici) ainsi qu'une liste de Membres à insérer lors à la base de donnée lors du démarrage.
#
# Important: l'importation ne fait qu'un unmarshal du fichier json et aucune vérification supplémentaire, ni même une vérification d'insertion de doublons dans la db. Fonctionalité à utiliser calmement.
bottin server --db-type 'sqlite' --db-sqlite-path '/chemin/vers/bottin-database.db' --json-insert-path '/chemin/vers/liste_de_membre.json'`
Avec viper
  1. Ajouter config en suivant documentation dans help, -h, --help

  2. Appeler config avec flag global --config /chemin/vers/config.

Note: L'endroit par défaut de la config est $HOME/.bottin.yaml, mais un autre emplacement peut être utilisé si désiré. Dockerfile utilise /etc/bottin/bottin.yaml comme défaut.

La seule option qui n'est présentement pas disponible par config file est --json-insert-path afin de prévenir des doublons. Explication complète dans la définition de flag.

Documentation

Overview

Copyright © 2022 AGECEM & Victor Lacasse-Beaudoin

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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