Documentation ¶
Overview ¶
Package appsettings implements functions for changing settings of the app.
App settings are anything that changes functionality of the app.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrAppSettingsDoNotExist = errors.New("appsettings: info does not exist")
ErrAppSettingsDoNotExist is thrown when no app settings exist yet
Functions ¶
func GenerateAPIKey ¶
func GenerateAPIKey(w http.ResponseWriter, r *http.Request)
GenerateAPIKey creates a new api key and saves it to the datastore the key is also returned to update the gui limit api key length so it is easier to use multiple calls to this func will "rotate" the api key
func GetAPI ¶
func GetAPI(w http.ResponseWriter, r *http.Request)
GetAPI is used when viewing the data in the gui or on a receipt
func SaveAPI ¶
func SaveAPI(w http.ResponseWriter, r *http.Request)
SaveAPI saves new or updates existing company info in the datastore
func SaveDefaultInfo ¶
SaveDefaultInfo sets some default data when a company first starts using this app This func is called when the initial super admin is created.
Types ¶
type Settings ¶
type Settings struct { RequireCustomerID bool `json:"require_cust_id"` //is the customer id field required when adding a new card CustomerIDFormat string `json:"cust_id_format"` //the format of the customer id from a CRM system. This shows up in the gui. CustomerIDRegex string `json:"cust_id_regex"` //the regex to check the customer id against. ReportTimezone string `json:"report_timezone"` //the tz database name of the timezone we want to show reports and receipt times in APIKey string `json:"api_key"` //the api key to access this app to automatically charge cards }
Settings is used for setting or getting the app settings from the datastore