diff options
author | neodarz <neodarz@neodarz.net> | 2019-05-26 12:53:06 +0200 |
---|---|---|
committer | neodarz <neodarz@neodarz.net> | 2019-05-26 12:53:06 +0200 |
commit | 9d57dc83b706aa229874607204668afb3415d168 (patch) | |
tree | 25cbb49b594389ad40179374ad5dbbbeaec2bf71 | |
parent | 075cde20b4dbc9e43924a5b469a6bf3ddeb48d38 (diff) | |
download | my_new_personal_website-9d57dc83b706aa229874607204668afb3415d168.tar.xz my_new_personal_website-9d57dc83b706aa229874607204668afb3415d168.zip |
Move config to external file
-rw-r--r-- | config/__init__.py | 0 | ||||
-rw-r--r-- | config/config.py | 56 | ||||
-rwxr-xr-x | pyblog | 52 |
3 files changed, 57 insertions, 51 deletions
diff --git a/config/__init__.py b/config/__init__.py new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/config/__init__.py diff --git a/config/config.py b/config/config.py new file mode 100644 index 00000000..144d0fbf --- /dev/null +++ b/config/config.py @@ -0,0 +1,56 @@ +#!/bin/python3 + +import os +import toml + +ROOTDIR = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) + + +config_blog = toml.load(os.path.join(ROOTDIR, "config/blog.toml")) +config_generator = toml.load(os.path.join(ROOTDIR, "config/generator.toml")) + + +config = {**config_blog, **config_generator} + +# Blog configuration +BLOG_HOME = config["blog"]["BLOG_HOME"] +CUSTOM_DOMAIN = config["blog"]["CUSTOM_DOMAIN"] +BLOG_TITLE = config["blog"]["BLOG_TITLE"] +BLOG_DESCRIPTION = config["blog"]["BLOG_DESCRIPTION"] +LANGUAGE = config["blog"]["LANGUAGE"] +AUTHOR = config["blog"]["AUTHOR"] +AUTHOR_EMAIL = config["blog"]["AUTHOR_EMAIL"] +ATOM_ICON_PATH = config["blog"]["ATOM_ICON_PATH"] +RSS_ICON_PATH = config["blog"]["RSS_ICON_PATH"] +RSS_ICON_WIDTH = config["blog"]["RSS_ICON_WIDTH"] +RSS_ICON_HEIGHT = config["blog"]["RSS_ICON_HEIGHT"] + +#generator configurations +GENERATOR_NAME = config["generator"]["GENERATOR_NAME"] +GENERATOR_HOME_PAGE = config["generator"]["GENERATOR_HOME_PAGE"] + +SOURCEDIR = os.path.join(ROOTDIR, config["generator"]["SOURCEDIR"]) +POSTSDIR = os.path.join(SOURCEDIR, config["generator"]["POSTSDIR"]) +INDEXMD = os.path.join(SOURCEDIR, config["generator"]["INDEXMD"]) +GENERATORSOURCE = os.path.join(ROOTDIR, config["generator"]["GENERATORSOURCE"]) +HTMLTEMPLATE = os.path.join(SOURCEDIR, config["generator"]["HTMLTEMPLATE"]) +BUILDDIR = os.path.join(ROOTDIR, config["generator"]["BUILDDIR"]) +ATOM = os.path.join(BUILDDIR, config["generator"]["ATOM"]) +RSS = os.path.join(BUILDDIR, config["generator"]["RSS"]) +INDEXHTML = os.path.join(BUILDDIR, config["generator"]["INDEXHTML"]) +EXCLUDELIST = os.path.join(SOURCEDIR, config["generator"]["EXCLUDELIST"]) + +FEED_MAX_ENTRIES = config["generator"]["FEED_MAX_ENTRIES"] +CODE_LINE_HEIGHT = config["generator"]["CODE_LINE_HEIGHT"] + + +# declare the global foreground ANSI codes +BLACK = "" +BLUE = "" +CYAN = "" +GREEN = "" +MAGENTA = "" +RED = "" +WHITE = "" +YELLOW = "" +RESET = "" @@ -46,57 +46,7 @@ from rss import * from utils import utils -ROOTDIR = os.path.dirname(os.path.realpath(__file__)) - - -config_blog = toml.load(os.path.join(ROOTDIR, "config/blog.toml")) -config_generator = toml.load(os.path.join(ROOTDIR, "config/generator.toml")) - - -config = {**config_blog, **config_generator} - -# Blog configuration -BLOG_HOME = config["blog"]["BLOG_HOME"] -CUSTOM_DOMAIN = config["blog"]["CUSTOM_DOMAIN"] -BLOG_TITLE = config["blog"]["BLOG_TITLE"] -BLOG_DESCRIPTION = config["blog"]["BLOG_DESCRIPTION"] -LANGUAGE = config["blog"]["LANGUAGE"] -AUTHOR = config["blog"]["AUTHOR"] -AUTHOR_EMAIL = config["blog"]["AUTHOR_EMAIL"] -ATOM_ICON_PATH = config["blog"]["ATOM_ICON_PATH"] -RSS_ICON_PATH = config["blog"]["RSS_ICON_PATH"] -RSS_ICON_WIDTH = config["blog"]["RSS_ICON_WIDTH"] -RSS_ICON_HEIGHT = config["blog"]["RSS_ICON_HEIGHT"] - -#generator configurations -GENERATOR_NAME = config["generator"]["GENERATOR_NAME"] -GENERATOR_HOME_PAGE = config["generator"]["GENERATOR_HOME_PAGE"] - -SOURCEDIR = os.path.join(ROOTDIR, config["generator"]["SOURCEDIR"]) -POSTSDIR = os.path.join(SOURCEDIR, config["generator"]["POSTSDIR"]) -INDEXMD = os.path.join(SOURCEDIR, config["generator"]["INDEXMD"]) -GENERATORSOURCE = os.path.join(ROOTDIR, config["generator"]["GENERATORSOURCE"]) -HTMLTEMPLATE = os.path.join(SOURCEDIR, config["generator"]["HTMLTEMPLATE"]) -BUILDDIR = os.path.join(ROOTDIR, config["generator"]["BUILDDIR"]) -ATOM = os.path.join(BUILDDIR, config["generator"]["ATOM"]) -RSS = os.path.join(BUILDDIR, config["generator"]["RSS"]) -INDEXHTML = os.path.join(BUILDDIR, config["generator"]["INDEXHTML"]) -EXCLUDELIST = os.path.join(SOURCEDIR, config["generator"]["EXCLUDELIST"]) - -FEED_MAX_ENTRIES = config["generator"]["FEED_MAX_ENTRIES"] -CODE_LINE_HEIGHT = config["generator"]["CODE_LINE_HEIGHT"] - - -# declare the global foreground ANSI codes -BLACK = "" -BLUE = "" -CYAN = "" -GREEN = "" -MAGENTA = "" -RED = "" -WHITE = "" -YELLOW = "" -RESET = "" +from config.config import * def generate_menu(): |