Exemplo n.º 1
0
func init() {
	cl := loc + "/.cookies"
	logger.WriteString("Removing the existing .cookies file")
	os.Remove(cl)

	// this is here because apparently auth's init() is called before this one is
	if _, err := os.Stat(cl); os.IsNotExist(err) {
		logger.WriteString("Creating a new .cookies file.")
		file, e := os.Create(cl)
		if e != nil {
			logger.WriteString("There was an error creating the .cookies file.")
		}
		file.Close()
	}

	if _, err := os.Stat(loc + "/.password"); os.IsNotExist(err) {
		logger.WriteString("The .password file does not exist. Creating a new .password file.")
		file, e := os.Create(loc + "/.password")
		if e != nil {
			logger.WriteString("There was an error creating the .password file.")
		}
		file.Close()
	}

	logger.WriteString("Setting the port number to " + configuration.GetPortNumber())
	portNumber = ":" + configuration.GetPortNumber()
}
Exemplo n.º 2
0
// Loads the settings from the config file
func buildConfigStruct(cp *configPage) {
	cp.DeviceIP = configuration.GetDeviceIP()
	cp.Port = configuration.GetPortNumber()
	cp.InternalAddr = configuration.GetInternalIPs()
	cp.ExternalAddr = configuration.GetExternalIPs()
	cp.ExternalURL = configuration.GetExternalURLs()
	cp.SpeedFileLoc = configuration.GetSpeedFileLocation()
	cp.ReportFileLoc = configuration.GetReportsLocation()
	cp.PingDelay = configuration.GetPingDelay()
	cp.SpeedDelay = configuration.GetSpeedDelay()
}