Example #1
0
func init() {
	common.InitErisDir()
	common.InitDataDir(ClientCache)
	common.InitDataDir(ServerCache)

	f := path.Join(common.LanguagesPath, "config.json")
	err := checkConfig(f)
	if err != nil {
		logger.Errorln(err)
		logger.Errorln("resorting to default language settings")
		return
	}
}
Example #2
0
func cliClient(c *cli.Context) {
	if len(c.Args()) == 0 {
		ifExit(fmt.Errorf("Specify a contract to compile"))
	}
	tocompile := c.Args()[0]

	var err error
	lang := c.String("language")
	if lang == "" {
		lang, err = lllcserver.LangFromFile(tocompile)
		ifExit(err)
	}

	host := c.String("host")
	if host != "" {
		url := host + "/" + "compile"
		lllcserver.SetLanguageURL(lang, url)
	}
	logger.Debugln("language config:", lllcserver.Languages[lang])

	common.InitDataDir(lllcserver.ClientCache)
	logger.Infoln("compiling", tocompile)
	if c.Bool("local") {
		lllcserver.SetLanguageNet(lang, false)
		//b, err := lllcserver.CompileWrapper(tocompile, lang)
		// force it through the compile pipeline so we get caching
		b, abi, err := lllcserver.Compile(tocompile)
		ifExit(err)
		logger.Infoln("bytecode:", hex.EncodeToString(b))
		logger.Infoln("abi:", abi)
	} else {
		code, abi, err := lllcserver.Compile(tocompile)
		if err != nil {
			fmt.Println(err)
		}
		logger.Infoln("bytecode:", hex.EncodeToString(code))
		logger.Infoln("abi:", abi)
	}
}
Example #3
0
func cliServer(c *cli.Context) {

	common.InitDataDir(lllcserver.ServerCache)
	addrUnsecure := ""
	addrSecure := ""

	if c.Bool("internal") {
		addrUnsecure = "localhost"
		addrSecure = "localhost"
	}

	addrUnsecure += ":" + strconv.Itoa(c.Int("unsecure-port"))
	addrSecure += ":" + strconv.Itoa(c.Int("secure-port"))

	if c.Bool("secure-only") {
		addrUnsecure = ""
	}
	if c.Bool("no-ssl") {
		addrSecure = ""
	}

	key := c.String("key")
	cert := c.String("cert")

	if !c.Bool("no-ssl") {

		if _, err := os.Stat(key); os.IsNotExist(err) {
			common.Exit(fmt.Errorf("Can't find ssl key %s. Use --no-ssl flag to disable", key))
		}
		if _, err := os.Stat(cert); os.IsNotExist(err) {
			common.Exit(fmt.Errorf("Can't find ssl cert %s. Use --no-ssl flag to disable", cert))
		}

	}

	lllcserver.StartServer(addrUnsecure, addrSecure, key, cert)
}