cmd

package
v0.0.0-...-2d2ac8f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 26, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RunCommand = cli.Command{
	Name:      "run",
	Aliases:   []string{"run"},
	Usage:     "start fil-data run service",
	UsageText: `fil-data run`,

	Action: func(cCtx *cli.Context) error {
		ctx := cCtx.Context

		var sm = &intern.ServiceManage{}
		pg_host := os.Getenv("PG_HOST")
		pg_port := os.Getenv("PG_PORT")
		pg_user := os.Getenv("PG_USER")
		pg_password := os.Getenv("PG_PASSWORD")
		pg_db := os.Getenv("PG_DBNAME")
		dsn := fmt.Sprintf("host=%s user=%s password=%s dbname=%s port=%s sslmode=disable TimeZone=Asia/Shanghai", pg_host, pg_user, pg_password, pg_db, pg_port)
		pd_db, err := initDatabase(dsn)
		if err != nil {
			return err
		}

		err = setupDatabase(pd_db)
		if err != nil {
			return err
		}

		sm.DB = pd_db

		return sm.ServeAPI(ctx)

	},
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL