config

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// GlobalOption is khadijah global config option
	GlobalOption = new(Option)
	// UserConfigDir is user config directory, default be ""
	UserConfigDir string
	// ConfigFile is user config file name
	ConfigFile = "config"
)

Functions

func LoadOption

func LoadOption() (err error)

LoadOption is the function to Load config option from local path

func Save

func Save() (err error)

Save config to user local home path

func SetAPIKey

func SetAPIKey(key string) (err error)

SetAPIKey is the function to set APIKey to global option

func SetSystem

func SetSystem(sys System) (err error)

SetSystem is the function to set system info to global option

func SetToken

func SetToken(t string) (err error)

SetToken is the function to set token to global option

func SetUser

func SetUser(u *User) (err error)

SetUser is the function to set user to global option

Types

type Option

type Option struct {
	Token  string  `json:"token"`
	User   *User   `json:"user"`
	APIKey string  `json:"apiKey"`
	System *System `json:"system"`
}

Option is the basic option for khadijah-wayne

type System

type System struct {
	Version      string `json:"version"`
	BaseURL      string `json:"baseURL"`
	WebsocketURL string `json:"websocketURL"`
}

System is the basic system info for khadijah-wayne

type User

type User struct {
	Username string `json:"username"`
}

User is the user info of login user

Jump to

Keyboard shortcuts

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