@@ -53,9 +53,7 @@ class encryptContentPlugin(BasePlugin):
5353 """ Plugin that encrypt markdown content with AES and inject decrypt form. """
5454
5555 config_scheme = (
56- # dev: use github secret
57- ('use_secret' , config_options .Type (bool , default = False )),
58- # _________________________________________________________ #
56+ ('use_secret' , config_options .Type (string_types , default = None )),
5957 ('title_prefix' , config_options .Type (string_types , default = str (SETTINGS ['title_prefix' ]))),
6058 ('summary' , config_options .Type (string_types , default = str (SETTINGS ['summary' ]))),
6159 ('placeholder' , config_options .Type (string_types , default = str (SETTINGS ['placeholder' ]))),
@@ -154,9 +152,14 @@ def on_config(self, config, **kwargs):
154152 :param config: global configuration object (mkdocs.yml)
155153 :return: global configuration object modified to include templates files
156154 """
157- # Optionnaly use Github secret
158- if self .config ['use_secret' ]:
159- self .config ['global_password' ] = os .environ .get ('PASSWORD' )
155+ # Optionnaly use Github secret
156+ if self .config .get ('use_secret' ):
157+ if os .environ .get (str (self .config ['use_secret' ])):
158+ self .config ['global_password' ] = os .environ .get (str (self .config ['use_secret' ]))
159+ else :
160+ logger .error (('Cannot get global password from environment variable: ' ),
161+ (f"{ str (self .config ['use_secret' ])} . Abort !" ))
162+ os .exit ()
160163 # Set global password as default password for each page
161164 self .config ['password' ] = self .config ['global_password' ]
162165 # Check if hljs feature need to be enabled, based on theme configuration
0 commit comments