File tree Expand file tree Collapse file tree 9 files changed +23
-10
lines changed Expand file tree Collapse file tree 9 files changed +23
-10
lines changed Original file line number Diff line number Diff line change 24
24
"""
25
25
Load user config specified by an argument or in default path.
26
26
"""
27
- config = Config ()
27
+
28
+
29
+ try :
30
+ config = Config ()
31
+ except KeyError as e :
32
+ import sys
33
+ print ("Missing item in config %s" % e )
34
+ sys .exit ()
28
35
29
36
from .dbConnector import dbConnector
30
37
from .session import SessionManager
Original file line number Diff line number Diff line change 5
5
import sys
6
6
import os
7
7
from liberouterapi import app
8
+ import logging
9
+
10
+ log = logging .getLogger (__name__ )
8
11
9
12
import unittest
10
13
class Config (object ):
@@ -29,6 +32,10 @@ def __init__(self):
29
32
30
33
self .config .read (args ['config' ])
31
34
35
+ # Check if config was loaded successfully, api section must be there
36
+ if "api" not in self .config :
37
+ log .error ("Missing config file" )
38
+
32
39
self .DEBUG = self .config ["api" ].getboolean ("debug" , True )
33
40
self .HOST = self .config ["api" ].get ("host" , "localhost" )
34
41
self .PORT = self .config ["api" ].getint ("port" , 8000 )
Original file line number Diff line number Diff line change @@ -90,8 +90,6 @@ def mongodb(self):
90
90
# Small trick to catch exception for unavailable database
91
91
except pymongo .errors .ServerSelectionTimeoutError as err :
92
92
app .logger .error ("Failed to connect to database: " + str (err ))
93
- print (err )
94
- exit (1 )
95
93
96
94
def sqlite (self ):
97
95
from flask_sqlalchemy import SQLAlchemy
Original file line number Diff line number Diff line change @@ -40,3 +40,4 @@ testem.log
40
40
Thumbs.db
41
41
42
42
config.json
43
+ . /.htaccess
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " liberouter-gui" ,
3
- "version" : " 0.3.0 " ,
3
+ "version" : " 0.3.1 " ,
4
4
"license" : " MIT" ,
5
5
"angular-cli" : {},
6
6
"scripts" : {
File renamed without changes.
Original file line number Diff line number Diff line change @@ -11,8 +11,6 @@ <h1 class="user-area">
11
11
{{ user?.user?.username }}
12
12
</ a >
13
13
< div class ="dropdown-menu " aria-labelledby ="userActions ">
14
- < button class ="dropdown-item "> Action - 1</ button >
15
- < button class ="dropdown-item " routerLink ='["users", user["user"]["_id"]["$oid"]] '> Profile</ button >
16
14
< button class ="dropdown-item " routerLink ="logout ">
17
15
Logout
18
16
</ button >
Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ export class FtasComponent implements OnInit {
47
47
params : Object ;
48
48
49
49
// Configuration fetched froms backend
50
- config : Object ;
50
+ config : Object = { } ;
51
51
52
52
// Output ID
53
53
output : number ;
@@ -116,9 +116,11 @@ export class FtasComponent implements OnInit {
116
116
this . baseUrl += this . config [ 'url' ] + "/ftas/stat.pl" ;
117
117
}
118
118
119
- this . output = + this . config [ 'output' ] || - 1 ;
119
+ this . output = + this . config [ 'output' ] ;
120
120
121
- if ( this . output == - 1 || this . baseUrl == "https://" ) {
121
+ console . log ( this . baseUrl , this . output )
122
+
123
+ if ( isNaN ( this . output ) || this . baseUrl == "https://" ) {
122
124
console . warn ( "FTAS output or URL isn't set." ) ;
123
125
124
126
// Open modal window
Original file line number Diff line number Diff line change @@ -106,7 +106,7 @@ export class NerdComponent implements OnInit {
106
106
this . openSettings ( ) ;
107
107
}
108
108
109
- if ( ! this . params [ "ip" ] )
109
+ if ( ! this . params || ! this . params [ "ip" ] )
110
110
this . url = this . baseUrl ;
111
111
else {
112
112
this . url = this . baseUrl + "/ip/" + this . params [ "ip" ] ;
You can’t perform that action at this time.
0 commit comments