2021-03-15 20:29:43 +01:00
/ *
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 < https : //www.gnu.org/licenses/>.
* /
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" )
2021-03-22 09:09:21 +01:00
config . ForB64 = os . Getenv ( "MM_ASSOS_FORB64" )
2021-03-15 20:29:43 +01:00
2021-03-22 09:09:21 +01:00
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" )
2021-03-15 20:29:43 +01:00
}
return config
}