about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUltraQbik <no1skill@yandex.ru>2024-08-30 20:03:59 +0300
committerUltraQbik <no1skill@yandex.ru>2024-08-30 20:03:59 +0300
commit38030e9d3930fb25ee422ac6061a3d6f58b05324 (patch)
treec652804c18b3f98cc2298cd51bea83a76f743b92
parent9d618baeafd73ef4ea1d6a2ec90d87f63bb8908c (diff)
downloadhttpy-38030e9d3930fb25ee422ac6061a3d6f58b05324.tar.gz
httpy-38030e9d3930fb25ee422ac6061a3d6f58b05324.zip
Update argparse
Renamed --dont-compress-path to --compress-path
Moved compressed path prefix to config.py
-rw-r--r--main.py13
-rw-r--r--src/config.py1
2 files changed, 6 insertions, 8 deletions
diff --git a/main.py b/main.py
index 60bb023..360bb2b 100644
--- a/main.py
+++ b/main.py
@@ -51,13 +51,10 @@ _parser.add_argument("-c", "--cert",
 _parser.add_argument("-k", "--priv-key",
                      help="private key",
                      required=True)
-_parser.add_argument("--dont-compress-path",
-                     help="disables pre-compression of files in 'www' folder (default True)",
-                     default=False,
+_parser.add_argument("--compress-path",
+                     help="enables pre-compression of files in 'www' folder (default True)",
+                     default=True,
                      action="store_true")
-_parser.add_argument("--compressed-path",
-                     help="path where compressed directory will be stored (default 'compress')",
-                     default="compress")
 _parser.add_argument("--disable-ssl",
                      help="SSL for HTTPs encrypted connection (default True)",
                      default=False,
@@ -329,10 +326,10 @@ class HTTPServer:
 
 def main():
     path_map = file_man.generate_path_map(verbose=ARGS.verbose)
-    if not ARGS.dont_compress_path:
+    if ARGS.compress_path:
         path_map = file_man.compress_path_map(
             path_map,
-            path_prefix=ARGS.compressed_path,
+            path_prefix=FILE_MAN_COMPRESSED_PATH,
             regen=True,
             verbose=ARGS.verbose)
 
diff --git a/src/config.py b/src/config.py
index 2f9d4b0..549f130 100644
--- a/src/config.py
+++ b/src/config.py
@@ -20,6 +20,7 @@ API_VERSIONS = {
 }
 
 # file manager
+FILE_MAN_COMPRESSED_PATH = "compress"
 FILE_MAN_PATH_MAP = {
     # external
     "/":                {"path": "www/index.html", "compress": True},