/* Pont Mattermost Portail des assos Copyright (C) 2021 Romain de Laage This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see . */ package main import ( "log" "os" ) func getConfig() Config { var config Config config.ChannelId = os.Getenv("MM_ASSOS_CHANNEL") config.ApiToken = os.Getenv("MM_ASSOS_TOKEN") config.ApiEndpointMM = os.Getenv("MM_ASSOS_ENDPOINTMM") config.ApiEndpointAssos = os.Getenv("MM_ASSOS_ENDPOINTASSOS") config.DbPath = os.Getenv("MM_ASSOS_DBPATH") config.ForB64 = os.Getenv("MM_ASSOS_FORB64") if config.ChannelId == "" || config.ApiToken == "" || config.ApiEndpointMM == "" || config.ApiEndpointAssos == "" || config.DbPath == "" || config.ForB64 == "" { log.Fatalln("MM_ASSOS_CHANNEL, MM_ASSOS_ENDPOINTMM, MM_ASSOS_ENDPOINTASSOS, MM_ASSOS_DBPATH, MM_ASSOS_TOKEN or MM_ASSOS_FORB64 not defined or empty string") } return config }