import sys from gfl.conf import GflConf from gfl.application import Application from gfl.shell import Shell GflConf.home_dir = "data" GflConf.load() if __name__ == "__main__": sys.stderr = open("std.err", "w") console = True role = "server" Shell.welcome() Application.run(role, console) sys.stderr.close()
def detect_homedir(args_home): if args_home is not None: return args_home env = os.getenv("GFL_HOME") if env is not None: return env return GflConf.home_dir if __name__ == "__main__": args = parser.parse_args() GflConf.home_dir = detect_homedir(args.home) if args.action == "attach": Shell.attach(args.host, args.port) else: GflConf.load() Shell.welcome() if args.action == "init": Application.init(args.force) elif args.action == "run": props = {} if args.props: for p in args.props: kv = p.split("=") props[kv[0]] = kv[1] Application.run(role=args.role, console=args.console, **props) else: print("unknown action.")
from gfl.application import Application from gfl.conf import GflConf if __name__ == "__main__": GflConf.home_dir = "data" Application.run(daemon=False)
def server(args): if args.home is not None: GflConf.home_dir = args.home Application.run(role="server", daemon=args.d)
import os from gfl.application import Application from gfl.conf import GflConf GflConf.home_dir = os.path.join(os.path.dirname(__file__), "../data") if __name__ == "__main__": Application.run(True)
def client(args): if args.home is not None: GflConf.home_dir = args.home Application.run(role="client")
from gfl.conf import GflConf from gfl.application import Application from gfl.shell import Shell GflConf.home_dir = "data" GflConf.load() if __name__ == "__main__": Shell.welcome() Application.init(True)