Minor improvements

This commit is contained in:
krateng 2021-12-24 21:23:02 +01:00
parent 6fc2c1c889
commit a1ba5f58b8
3 changed files with 27 additions and 5 deletions

View File

@ -19,10 +19,9 @@ You can check [my own Maloja page](https://maloja.krateng.ch) to see what it loo
## Table of Contents ## Table of Contents
* [Features](#features) * [Features](#features)
* [How to install](#how-to-install) * [How to install](#how-to-install)
* [Environment](#environment) * [LXC / VM / Bare Metal](#lxc--vm--bare-metal)
* [New Installation](#new-installation)
* [Update](#update)
* [Docker](#docker) * [Docker](#docker)
* [Extras](#extras)
* [How to use](#how-to-use) * [How to use](#how-to-use)
* [Basic control](#basic-control) * [Basic control](#basic-control)
* [Data](#data) * [Data](#data)
@ -124,16 +123,26 @@ An example of a minimum run configuration when accessing maloja from an IPv4 add
Start and stop the server with Start and stop the server with
```console
maloja start maloja start
maloja stop maloja stop
maloja restart maloja restart
```
If something is not working, you can try If something is not working, you can try
```console
maloja debug maloja debug
```
to run the server in the foreground. to run the server in the foreground.
```console
maloja info
```
will give you some basic information about your install.
### Data ### Data

View File

@ -2,6 +2,8 @@ import os
from doreah.configuration import Configuration from doreah.configuration import Configuration
from doreah.configuration import types as tp from doreah.configuration import types as tp
from .__pkginfo__ import versionstr
# if DATA_DIRECTORY is specified, this is the directory to use for EVERYTHING, no matter what # if DATA_DIRECTORY is specified, this is the directory to use for EVERYTHING, no matter what
@ -270,6 +272,13 @@ data_dir = {
### write down the last ran version
with open(pthj(dir_settings['state'],".lastmalojaversion"),"w") as filed:
filed.write(versionstr)
filed.write("\n")
### DOREAH CONFIGURATION ### DOREAH CONFIGURATION

View File

@ -95,13 +95,14 @@ def print_info():
print_header_info() print_header_info()
print("Configuration Directory:",globalconf.dir_settings['config']) print("Configuration Directory:",globalconf.dir_settings['config'])
print("Data Directory: ",globalconf.dir_settings['state']) print("Data Directory: ",globalconf.dir_settings['state'])
print("Log Directory: ",globalconf.dir_settings['logs'])
print("Network: ",f"IPv{ip_address(globalconf.malojaconfig['host']).version}, Port {globalconf.malojaconfig['port']}") print("Network: ",f"IPv{ip_address(globalconf.malojaconfig['host']).version}, Port {globalconf.malojaconfig['port']}")
print("Timezone: ",f"UTC{globalconf.malojaconfig['timezone']:+d}") print("Timezone: ",f"UTC{globalconf.malojaconfig['timezone']:+d}")
print() print()
print("#####") print("#####")
print() print()
@mainfunction({"l":"level"},shield=True) @mainfunction({"l":"level","v":"version"},flags=['version'],shield=True)
def main(*args,**kwargs): def main(*args,**kwargs):
actions = { actions = {
@ -118,7 +119,10 @@ def main(*args,**kwargs):
"info":print_info "info":print_info
} }
if len(args) > 0: if "version" in kwargs:
print(info.versionstr)
elif len(args) > 0:
action = args[0] action = args[0]
args = args[1:] args = args[1:]
if action in actions: actions[action](*args,**kwargs) if action in actions: actions[action](*args,**kwargs)