mirror of
https://github.com/luxfi/oraclevm.git
synced 2026-10-30 15:23:15 +00:00
50 lines
1.1 KiB
Go
50 lines
1.1 KiB
Go
// Copyright (C) 2023, Ava Labs, Inc. All rights reserved.
|
|
// See the file LICENSE for licensing terms.
|
|
|
|
package main
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"os"
|
|
|
|
"github.com/ava-labs/avalanchego/utils/logging"
|
|
"github.com/ava-labs/avalanchego/utils/ulimit"
|
|
"github.com/ava-labs/avalanchego/vms/rpcchainvm"
|
|
"github.com/bianyuanop/oraclevm/cmd/morpheusvm/version"
|
|
"github.com/bianyuanop/oraclevm/controller"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
var rootCmd = &cobra.Command{
|
|
Use: "morpheusvm",
|
|
Short: "BaseVM agent",
|
|
SuggestFor: []string{"morpheusvm"},
|
|
RunE: runFunc,
|
|
}
|
|
|
|
func init() {
|
|
cobra.EnablePrefixMatching = true
|
|
}
|
|
|
|
func init() {
|
|
rootCmd.AddCommand(
|
|
version.NewCommand(),
|
|
)
|
|
}
|
|
|
|
func main() {
|
|
if err := rootCmd.Execute(); err != nil {
|
|
fmt.Fprintf(os.Stderr, "morpheusvm failed %v\n", err)
|
|
os.Exit(1)
|
|
}
|
|
os.Exit(0)
|
|
}
|
|
|
|
func runFunc(*cobra.Command, []string) error {
|
|
if err := ulimit.Set(ulimit.DefaultFDLimit, logging.NoLog{}); err != nil {
|
|
return fmt.Errorf("%w: failed to set fd limit correctly", err)
|
|
}
|
|
return rpcchainvm.Serve(context.TODO(), controller.New())
|
|
}
|