File tree Expand file tree Collapse file tree 1 file changed +16
-3
lines changed Expand file tree Collapse file tree 1 file changed +16
-3
lines changed Original file line number Diff line number Diff line change 48
48
49
49
fReadOnly = flag .Bool ("readonly" , false , "disallow database changes" )
50
50
51
+ fImport = flag .String ("import" , "" , "import a JSON array of nodes" )
51
52
fTestDB = flag .Bool ("testdb" , false , "test the database" )
52
53
)
53
54
@@ -90,9 +91,6 @@ func main() {
90
91
os .Exit (1 )
91
92
}
92
93
93
- // Listen for OS signals.
94
- go ListenSignal ()
95
-
96
94
l .Infof ("Starting NodeAtlas %s\n " , Version )
97
95
98
96
// Compile and template the static directory.
@@ -159,6 +157,21 @@ func main() {
159
157
l .Debug ("Initialized database\n " )
160
158
l .Infof ("Nodes: %d (%d local)\n " , Db .LenNodes (true ), Db .LenNodes (false ))
161
159
160
+ // Check action flags and abandon normal startup if any are set.
161
+ if len (* fImport ) != 0 {
162
+ err := ImportFile (* fImport )
163
+ if err != nil {
164
+ l .Fatalf ("Import failed: %s" , err )
165
+ } else {
166
+ l .Printf ("Import successful!" )
167
+ }
168
+ return
169
+ }
170
+
171
+ // Listen for OS signals.
172
+ go ListenSignal ()
173
+
174
+ // Start the Heartbeat.
162
175
Heartbeat ()
163
176
l .Debug ("Heartbeat started\n " )
164
177
You can’t perform that action at this time.
0 commit comments