vikunja-api/vendor/code.vikunja.io/web/handler/config.go

51 lines
1.4 KiB
Go
Raw Permalink Normal View History

2019-03-24 10:13:40 +01:00
// Copyright (c) 2019 Vikunja and contributors.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser 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 Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package handler
import (
"code.vikunja.io/web"
"github.com/op/go-logging"
)
2019-10-23 23:11:40 +02:00
// Config contains the config for the web handler
2019-03-24 10:13:40 +01:00
type Config struct {
AuthProvider *web.Auths
LoggingProvider *logging.Logger
2019-10-23 23:11:40 +02:00
MaxItemsPerPage int
2019-03-24 10:13:40 +01:00
}
var config *Config
func init() {
config = &Config{}
}
2019-10-23 23:11:40 +02:00
// SetAuthProvider sets the auth provider in config
2019-03-24 10:13:40 +01:00
func SetAuthProvider(provider *web.Auths) {
config.AuthProvider = provider
}
2019-10-23 23:11:40 +02:00
// SetLoggingProvider sets the logging provider in the config
2019-03-24 10:13:40 +01:00
func SetLoggingProvider(logger *logging.Logger) {
config.LoggingProvider = logger
}
2019-10-23 23:11:40 +02:00
// SetMaxItemsPerPage sets the max number of items per page in the config
func SetMaxItemsPerPage(maxItemsPerPage int) {
config.MaxItemsPerPage = maxItemsPerPage
}