Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
0343486d
Commit
0343486d
authored
Oct 18, 2023
by
Hamdi Allam
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cli nit
parent
ff15ebf1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
4 deletions
+7
-4
cli.go
indexer/cmd/indexer/cli.go
+7
-4
No files found.
indexer/cmd/indexer/cli.go
View file @
0343486d
...
...
@@ -30,6 +30,8 @@ var (
func
runIndexer
(
ctx
*
cli
.
Context
)
error
{
log
:=
oplog
.
NewLogger
(
oplog
.
AppOut
(
ctx
),
oplog
.
ReadCLIConfig
(
ctx
))
.
New
(
"role"
,
"indexer"
)
oplog
.
SetGlobalLogHandler
(
log
.
GetHandler
())
log
.
Info
(
"running indexer..."
)
cfg
,
err
:=
config
.
LoadConfig
(
log
,
ctx
.
String
(
ConfigFlag
.
Name
))
if
err
!=
nil
{
log
.
Error
(
"failed to load config"
,
"err"
,
err
)
...
...
@@ -49,13 +51,14 @@ func runIndexer(ctx *cli.Context) error {
return
err
}
log
.
Info
(
"running indexer..."
)
return
indexer
.
Run
(
ctx
.
Context
)
}
func
runApi
(
ctx
*
cli
.
Context
)
error
{
log
:=
oplog
.
NewLogger
(
oplog
.
AppOut
(
ctx
),
oplog
.
ReadCLIConfig
(
ctx
))
.
New
(
"role"
,
"api"
)
oplog
.
SetGlobalLogHandler
(
log
.
GetHandler
())
log
.
Info
(
"running api..."
)
cfg
,
err
:=
config
.
LoadConfig
(
log
,
ctx
.
String
(
ConfigFlag
.
Name
))
if
err
!=
nil
{
log
.
Error
(
"failed to load config"
,
"err"
,
err
)
...
...
@@ -69,7 +72,6 @@ func runApi(ctx *cli.Context) error {
}
defer
db
.
Close
()
log
.
Info
(
"running api..."
)
api
:=
api
.
NewApi
(
log
,
db
.
BridgeTransfers
,
cfg
.
HTTPServer
,
cfg
.
MetricsServer
)
return
api
.
Run
(
ctx
.
Context
)
}
...
...
@@ -77,6 +79,8 @@ func runApi(ctx *cli.Context) error {
func
runMigrations
(
ctx
*
cli
.
Context
)
error
{
log
:=
oplog
.
NewLogger
(
oplog
.
AppOut
(
ctx
),
oplog
.
ReadCLIConfig
(
ctx
))
.
New
(
"role"
,
"migrations"
)
oplog
.
SetGlobalLogHandler
(
log
.
GetHandler
())
log
.
Info
(
"running migrations..."
)
cfg
,
err
:=
config
.
LoadConfig
(
log
,
ctx
.
String
(
ConfigFlag
.
Name
))
migrationsDir
:=
ctx
.
String
(
MigrationsFlag
.
Name
)
if
err
!=
nil
{
...
...
@@ -89,9 +93,8 @@ func runMigrations(ctx *cli.Context) error {
log
.
Error
(
"failed to connect to database"
,
"err"
,
err
)
return
err
}
defer
db
.
Close
()
log
.
Info
(
"running migrations..."
)
defer
db
.
Close
(
)
return
db
.
ExecuteSQLMigration
(
migrationsDir
)
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment