func (sys *SystemConfig) Ready() {
	sys.initSchema()

	cxn := sys.getDB()
	defer cxn.Close()

	// load settings table and overwrite anything we got from config with whatever is in the table
	if rows, err := cxn.Query("select Key, Value from Settings"); err != nil {
		panic(err)
	} else {
		defer rows.Close()

		var k, v string
		for rows.Next() {
			rows.Scan(&k, &v)
			if v == "" {
				continue
			}
			victim, ok := map[string]*string{
				"HomeURL":         &sys.HomeURL,
				"ServiceName":     &sys.ServiceName,
				"SessionCookieID": &sys.SessionCookieID,
				"CameraIDHeader":  &sys.CameraIDHeader,
				"DefaultImage":    &sys.DefaultImage,
				// specifically exclude SqlitePath here
			}[k]
			if ok {
				*victim = v
			} else {
				victim, ok := map[string]*int{
					"PollInterval": &sys.PollInterval,
				}[k]
				if ok {
					if intV, err := strconv.Atoi(v); err != nil {
						panic(err) // shouldn't be listed as an int field but not have an int value
					} else {
						*victim = intV
					}
				}
			}
		}
	}
}
// Ready prepares the instance for use, generally by bootstrapping config from its sqlite3 database.
// Any values on the instance will be overwritten by the database, meaning the only field strictly
// required for initialization is the sqlite3 file path.
Ready prepares the instance for use, generally by bootstrapping config from its sqlite3 database.
Any values on the instance will be overwritten by the database, meaning the only field strictly
required for initialization is the sqlite3 file path.
// Ready prepares the instance for use generally by bootstrapping config from its sqlite3 database . // Any values on the instance will be overwritten by the database meaning the only field strictly // required for initialization is the sqlite3 file path .
func (sys *SystemConfig) Ready() {
	sys.initSchema()
	cxn := sys.getDB()
	defer cxn.Close()
	if rows, err := cxn.Query("select Key, Value from Settings"); err != nil {
		panic(err)
	} else {
		defer rows.Close()
		var k, v string
		for rows.Next() {
			rows.Scan(&k, &v)
			if v == "" {
				continue
			}
			victim, ok := map[string]*string{
				"HomeURL":         &sys.HomeURL,
				"ServiceName":     &sys.ServiceName,
				"SessionCookieID": &sys.SessionCookieID,
				"CameraIDHeader":  &sys.CameraIDHeader,
				"DefaultImage":    &sys.DefaultImage,
			}[k]
			if ok {
				*victim = v
			} else {
				victim, ok := map[string]*int{
					"PollInterval": &sys.PollInterval,
				}[k]
				if ok {
					if intV, err := strconv.Atoi(v); err != nil {
						panic(err) 
					} else {
						*victim = intV
					}
				}
			}
		}
	}
}
func ( sys * SystemConfig ) Ready ( ) { sys . initSchema ( ) cxn := sys . getDB ( ) defer cxn . Close ( ) if rows , err := cxn . Query ( " " ) ; err != nil { panic ( err ) } else { defer rows . Close ( ) var k , v string for rows . Next ( ) { rows . Scan ( & k , & v ) if v == " " { continue } victim , ok := map [ string ] * string { " " : & sys . HomeURL , " " : & sys . ServiceName , " " : & sys . SessionCookieID , " " : & sys . CameraIDHeader , " " : & sys . DefaultImage , } [ k ] if ok { * victim = v } else { victim , ok := map [ string ] * int { " " : & sys . PollInterval , } [ k ] if ok { if intV , err := strconv . Atoi ( v ) ; err != nil { panic ( err ) } else { * victim = intV } } } } } }
Ready prepares the instance for use, generally by bootstrapping config from its sqlite3 database.
Ready prepares the instance for use generally by bootstrapping config from its sqlite3 database .
// load settings table and overwrite anything we got from config with whatever is in the table // specifically exclude SqlitePath here // shouldn't be listed as an int field but not have an int value