-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: add spdb address in env var * fix: stone node replicate idx * refactor: the entry and config * fix: ci lint error
- Loading branch information
1 parent
c7e5b4a
commit 871067e
Showing
25 changed files
with
456 additions
and
240 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package utils | ||
|
||
import ( | ||
"github.com/bnb-chain/greenfield-storage-provider/config" | ||
"github.com/bnb-chain/greenfield-storage-provider/store/sqldb" | ||
"github.com/urfave/cli/v2" | ||
) | ||
|
||
// MakeSPDB return sp db instance | ||
func MakeSPDB(ctx *cli.Context) (*sqldb.SpDBImpl, error) { | ||
spDBCfg := config.DefaultSQLDBConfig | ||
if ctx.IsSet(ctx.String(DBUserFlag.Name)) { | ||
spDBCfg.User = ctx.String(DBUserFlag.Name) | ||
} | ||
if ctx.IsSet(ctx.String(DBPasswordFlag.Name)) { | ||
spDBCfg.Passwd = ctx.String(DBPasswordFlag.Name) | ||
} | ||
if ctx.IsSet(ctx.String(DBAddressFlag.Name)) { | ||
spDBCfg.Address = ctx.String(DBAddressFlag.Name) | ||
} | ||
if ctx.IsSet(ctx.String(DBDataBaseFlag.Name)) { | ||
spDBCfg.Database = ctx.String(DBDataBaseFlag.Name) | ||
} | ||
return sqldb.NewSpDB(spDBCfg) | ||
} |
Oops, something went wrong.