gsmconfig

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2021 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package gsmconfig is responsible for all functions pertaining to the configuration of GSM Copyright © 2020-2021 Hannes Hayashi

This program is free software: you can redistribute it and/or modify it under the terms of the GNU 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 General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Index

Constants

This section is empty.

Variables

View Source
var CfgDir string

CfgDir should be set to the directory containing all GSM configuration files

Functions

func CreateConfig

func CreateConfig(config *GSMConfig) (string, error)

CreateConfig creates a new config

func GetConfigPath

func GetConfigPath(name string) string

GetConfigPath returns the file path to a config file

func GetScopes

func GetScopes(name string) (string, error)

GetScopes returns the scopes of a config file so they can be easily added in the Admin Console

func LoadConfig

func LoadConfig(name string) error

LoadConfig sets the default config (.gsm.yaml) and renames the old one to <name>.yaml

func RemoveConfig

func RemoveConfig(name string) error

RemoveConfig removes a config

Types

type GSMConfig

type GSMConfig struct {
	Name            string   `yaml:"name,omitempty"`
	CredentialsFile string   `yaml:"credentialsFile,omitempty"`
	Mode            string   `yaml:"mode,omitempty"`
	Subject         string   `yaml:"subject,omitempty"`
	LogFile         string   `yaml:"logFile,omitempty"`
	Scopes          []string `yaml:"scopes,omitempty"`
	Threads         int      `yaml:"threads,omitempty"`
	StandardDelay   int      `yaml:"standardDelay,omitempty"`
	Default         bool     `yaml:"default,omitempty"`
}

GSMConfig represents a GSM configuration

func GetConfig

func GetConfig(name string) (*GSMConfig, error)

GetConfig returns a single GSM config or an error

func ListConfigs

func ListConfigs() ([]*GSMConfig, error)

ListConfigs lists the config files in the config dir

func UpdateConfig added in v0.2.1

func UpdateConfig(config *GSMConfig, name string) (*GSMConfig, error)

UpdateConfig updates a new config

Jump to

Keyboard shortcuts

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