mirror of https://git.48k.eu/ogclient
#1065 Init config_path according to platform
Commitmore_events2dbcd18c06
breaks interfaceAdm path for live operations. Keep OG_PATH to the value prior to commit2dbcd18c06
. Check platform before reading config file. If platform is different from linux then look for cfg/ogclient.json in current folder and do not use OG_PATH.
parent
05f2fd43c2
commit
1601ad9b29
8
ogclient
8
ogclient
|
@ -11,6 +11,7 @@
|
|||
import json
|
||||
import logging
|
||||
import argparse
|
||||
import platform
|
||||
import subprocess
|
||||
try:
|
||||
from signal import SIG_DFL, SIGPIPE
|
||||
|
@ -52,7 +53,12 @@ def main():
|
|||
if args.func:
|
||||
args.func(args)
|
||||
return
|
||||
config_path = f'{ogClient.OG_PATH}cfg/ogclient.json'
|
||||
|
||||
if platform.system().lower() == 'linux':
|
||||
config_path = f'{ogClient.OG_PATH}ogclient/cfg/ogclient.json'
|
||||
else:
|
||||
config_path = './cfg/ogclient.json'
|
||||
|
||||
try:
|
||||
with open(config_path, 'r') as f:
|
||||
CONFIG = json.load(f)
|
||||
|
|
|
@ -11,7 +11,6 @@ import select
|
|||
import socket
|
||||
import time
|
||||
import email
|
||||
import platform
|
||||
from io import StringIO
|
||||
|
||||
from src.restRequest import *
|
||||
|
@ -24,10 +23,7 @@ class State(Enum):
|
|||
FORCE_DISCONNECTED = 2
|
||||
|
||||
class ogClient:
|
||||
if platform.system().lower() == 'linux':
|
||||
OG_PATH = '/opt/opengnsys/ogclient/'
|
||||
else:
|
||||
OG_PATH = './'
|
||||
OG_PATH = '/opt/opengnsys/'
|
||||
|
||||
def __init__(self, config):
|
||||
self.CONFIG = config
|
||||
|
|
Loading…
Reference in New Issue