Add database models and improve config/main

This commit is contained in:
Tulir Asokan
2018-08-13 23:24:44 +03:00
parent ace08205d9
commit fd3c1fb77c
11 changed files with 440 additions and 16 deletions

View File

@ -1,4 +1,4 @@
// mautrix-whatsapp - A Matrix-Whatsapp puppeting bridge.
// mautrix-whatsapp - A Matrix-WhatsApp puppeting bridge.
// Copyright (C) 2018 Tulir Asokan
//
// This program is free software: you can redistribute it and/or modify

View File

@ -1,4 +1,4 @@
// mautrix-whatsapp - A Matrix-Whatsapp puppeting bridge.
// mautrix-whatsapp - A Matrix-WhatsApp puppeting bridge.
// Copyright (C) 2018 Tulir Asokan
//
// This program is free software: you can redistribute it and/or modify
@ -33,7 +33,10 @@ type Config struct {
Hostname string `yaml:"hostname"`
Port uint16 `yaml:"port"`
Database string `yaml:"database"`
Database struct {
Type string `yaml:"type"`
URI string `yaml:"uri"`
} `yaml:"database"`
ID string `yaml:"id"`
Bot struct {
@ -70,7 +73,7 @@ func (config *Config) Save(path string) error {
return ioutil.WriteFile(path, data, 0600)
}
func (config *Config) Appservice() (*appservice.Config, error) {
func (config *Config) MakeAppService() (*appservice.AppService, error) {
as := appservice.Create()
as.LogConfig = config.Logging
as.HomeserverDomain = config.Homeserver.Domain

View File

@ -1,4 +1,4 @@
// mautrix-whatsapp - A Matrix-Whatsapp puppeting bridge.
// mautrix-whatsapp - A Matrix-WhatsApp puppeting bridge.
// Copyright (C) 2018 Tulir Asokan
//
// This program is free software: you can redistribute it and/or modify