func init() {
	logger.Init(ioutil.Discard, ioutil.Discard, ioutil.Discard, ioutil.Discard)
	privateKeyFilePath := flag.String("rsa-private", "./dist/key.private", "RSA private key file path")
	secureKeyFilePath := flag.String("secure-key", "./dist/secureKey", "password to encrypt the secure storage")
	usersDataPath := flag.String("data-file", "./dist/data.txt", "Login information file")
	flag.Parse()

	ServicePath = cr.ServicePathPrefix + cr.Version + AmPrefix
	resourcePath = listener + ServicePath + UsersPath

	usersList := en.New()
	signKey, verifyKey := app.TokenSetUp(*privateKeyFilePath)
	loginKey := ss.GetSecureKey(*secureKeyFilePath)
	en.LoadInfo(*usersDataPath, loginKey, usersList)

	stRestful = libsecurity_restful.NewLibsecurityRestful()
	stRestful.SetData(usersList, loginKey, verifyKey, signKey, nil)

	rootCookieStr, _ := app.GenerateToken(stc.RootUserName, am.SuperUserPermission, clientIP, signKey)
	cr.SetCookie(rootCookieStr)

	for _, name := range usersName {
		stRestful.UsersList.AddUser(name)
	}

	go runServer()
	time.Sleep(100 * time.Millisecond)
}
func main() {
	defaultRootPassword := stc.RootUserName

	secureKeyFileNamePath := flag.String("secure-key", "./secureKey", "secure key file path")
	loginFilePath := flag.String("storage-file", "./data.txt", "First storage file that includes the root user")
	rootPassword := flag.String("password", defaultRootPassword, "Root password")
	str := fmt.Sprintf("Generate RSA private/public files ('%s', '%s')", rsaPrivateKeyFileName, rsaPublicKeyFileName)
	generateRSA := flag.Bool("generate-rsa", false, str)
	flag.Parse()
	if flag.NArg() > 0 {
		usage()
	}

	if *rootPassword == defaultRootPassword {
		fmt.Printf("Error: The root password must be set (and not to '%v')\n", defaultRootPassword)
		usage()
	}
	if checkRootPasswordStrength(*rootPassword) == false {
		log.Fatalf("Error: The root password must be more complex: %v", passwordRules)
	}

	key := ss.GetSecureKey(*secureKeyFileNamePath)
	createBasicFile(*loginFilePath, stc.RootUserName, *rootPassword, key)
	fmt.Println("The generated file name is:", *loginFilePath)
	if *generateRSA {
		generateRSAKeys(rsaPrivateKeyFileName, rsaPublicKeyFileName)
	}
}
func registerComponents(configFile string, secureKeyFilePath string, privateKeyFilePath string, usersDataPath string) {
	conf, err := readConfigFile(configFile)
	if err != nil {
		fmt.Fprintf(os.Stderr, "Fatal error while reading configuration file '%v', error: %v\n", configFile, err)
		os.Exit(1)
	}
	wsContainer := restful.NewContainer()
	usersList := en.NewEntityManager()

	//	amUsers := am.NewAmUsersList()
	signKey, verifyKey = app.TokenSetUp(privateKeyFilePath)
	loginKey = ss.GetSecureKey(secureKeyFilePath)

	st := libsecurity_restful.NewLibsecurityRestful()
	st.SetData(usersList, loginKey, verifyKey, signKey, nil)

	l := accounts_restful.NewAmRestful()
	l.SetData(st)
	if conf[amToken] == fullToken {
		l.RegisterFull(wsContainer)
	} else { // login is mandatory
		l.RegisterBasic(wsContainer)
	}

	um := en_restful.NewEnRestful()
	um.SetData(st)
	if conf[umToken] != noneToken {
		um.RegisterBasic(wsContainer)
	}

	/*
		a := acl_restful.NewAclRestful()
		a.SetData(st)
		if conf[aclToken] == basicToken || conf[appAclToken] == basicToken {
			a.RegisterBasic(wsContainer)
		}
	*/
	/*
		appAclPermissions := appAcl.NewAppPermissions()
		st.STool.SetAppAclData(appAclPermissions)
		aa := appAcl_restful.NewAppAclRestful()
		aa.SetData(appAclPermissions, st)
		if conf[appAclToken] == basicToken {
			aa.RegisterBasic(wsContainer)
		}
	*/

	p := otp_restful.NewOtpRestful()
	p.SetData(st)
	if conf[otpToken] == basicToken {
		p.RegisterBasic(wsContainer)
	}

	o := ocra_restful.NewOcraRestful()
	o.SetData(st)
	if conf[ocraToken] == basicToken {
		o.RegisterBasic(wsContainer)
	}

	pwd := password_restful.NewPwdRestful()
	pwd.SetData(st)
	if conf[passwordToken] == basicToken {
		pwd.RegisterBasic(wsContainer)
	}

	ss := storage_restful.NewSsRestful()
	ss.SetData(st)
	if conf[secureStorageToken] == basicToken {
		ss.RegisterBasic(wsContainer)
	}

	st.RegisterBasic(wsContainer)

	err = en.LoadInfo(usersDataPath, loginKey, usersList)
	if err != nil {
		fmt.Println("Load info error:", err)
	}
	runRestApi(wsContainer)
}