mantis-cli 13.3.1__tar.gz → 14.0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. {mantis-cli-13.3.1/mantis_cli.egg-info → mantis-cli-14.0.1}/PKG-INFO +1 -1
  2. mantis-cli-14.0.1/mantis/__init__.py +1 -0
  3. {mantis-cli-13.3.1 → mantis-cli-14.0.1}/mantis/crypto.py +3 -8
  4. {mantis-cli-13.3.1 → mantis-cli-14.0.1}/mantis/managers.py +9 -6
  5. {mantis-cli-13.3.1 → mantis-cli-14.0.1/mantis_cli.egg-info}/PKG-INFO +1 -1
  6. mantis-cli-13.3.1/mantis/__init__.py +0 -1
  7. {mantis-cli-13.3.1 → mantis-cli-14.0.1}/.gitignore +0 -0
  8. {mantis-cli-13.3.1 → mantis-cli-14.0.1}/LICENSE +0 -0
  9. {mantis-cli-13.3.1 → mantis-cli-14.0.1}/MANIFEST.in +0 -0
  10. {mantis-cli-13.3.1 → mantis-cli-14.0.1}/README.md +0 -0
  11. {mantis-cli-13.3.1 → mantis-cli-14.0.1}/TODO +0 -0
  12. {mantis-cli-13.3.1 → mantis-cli-14.0.1}/mantis/__main__.py +0 -0
  13. {mantis-cli-13.3.1 → mantis-cli-14.0.1}/mantis/command_line.py +0 -0
  14. {mantis-cli-13.3.1 → mantis-cli-14.0.1}/mantis/environment.py +0 -0
  15. {mantis-cli-13.3.1 → mantis-cli-14.0.1}/mantis/extensions/__init__.py +0 -0
  16. {mantis-cli-13.3.1 → mantis-cli-14.0.1}/mantis/extensions/django.py +0 -0
  17. {mantis-cli-13.3.1 → mantis-cli-14.0.1}/mantis/extensions/nginx.py +0 -0
  18. {mantis-cli-13.3.1 → mantis-cli-14.0.1}/mantis/extensions/postgres.py +0 -0
  19. {mantis-cli-13.3.1 → mantis-cli-14.0.1}/mantis/helpers.py +0 -0
  20. {mantis-cli-13.3.1 → mantis-cli-14.0.1}/mantis/logic.py +0 -0
  21. {mantis-cli-13.3.1 → mantis-cli-14.0.1}/mantis_cli.egg-info/SOURCES.txt +0 -0
  22. {mantis-cli-13.3.1 → mantis-cli-14.0.1}/mantis_cli.egg-info/dependency_links.txt +0 -0
  23. {mantis-cli-13.3.1 → mantis-cli-14.0.1}/mantis_cli.egg-info/entry_points.txt +0 -0
  24. {mantis-cli-13.3.1 → mantis-cli-14.0.1}/mantis_cli.egg-info/requires.txt +0 -0
  25. {mantis-cli-13.3.1 → mantis-cli-14.0.1}/mantis_cli.egg-info/top_level.txt +0 -0
  26. {mantis-cli-13.3.1 → mantis-cli-14.0.1}/setup.cfg +0 -0
  27. {mantis-cli-13.3.1 → mantis-cli-14.0.1}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mantis-cli
3
- Version: 13.3.1
3
+ Version: 14.0.1
4
4
  Summary: Management command to build and deploy webapps, especially based on Django
5
5
  Home-page: https://github.com/PragmaticMates/mantis-cli
6
6
  Author: Erik Telepovský
@@ -0,0 +1 @@
1
+ VERSION = '14.0.1'
@@ -2,15 +2,12 @@ from base64 import b64encode, b64decode
2
2
 
3
3
  try:
4
4
  from Crypto.Cipher import AES
5
- from Crypto.Random import get_random_bytes
6
5
  from cryptography.fernet import Fernet
7
6
  except ImportError:
8
7
  # not using cryptography
9
- # pip install pycryptodome>=3.11.0
10
- # TODO: only if using environment encryption!
11
8
  raise ImportError('Install pycryptodome and cryptography!')
12
9
 
13
- from mantis.helpers import CLI
10
+ from mantis.helpers import CLI, random_string
14
11
 
15
12
 
16
13
  class Crypto(object):
@@ -18,10 +15,8 @@ class Crypto(object):
18
15
  def generate_key(deterministically=False):
19
16
  if deterministically:
20
17
  # deterministically: length has to be 32, 48 or 64
21
- x = random_string(64)
22
- from icecream import ic
23
- return x
24
-
18
+ return random_string(64)
19
+
25
20
  return Fernet.generate_key()
26
21
 
27
22
  @staticmethod
@@ -35,7 +35,7 @@ class BaseManager(object):
35
35
  self.init_environment()
36
36
 
37
37
  self.KEY = self.read_key()
38
- self.encrypt_deterministically = self.config.get('encrypt_deterministically', False)
38
+ self.encrypt_deterministically = self.config.get('encryption', {}).get('deterministic', True)
39
39
 
40
40
  @property
41
41
  def host(self):
@@ -118,18 +118,21 @@ class BaseManager(object):
118
118
 
119
119
  def init_config(self, config):
120
120
  self.config = config
121
- self.configs_path = self.config.get('configs', {}).get('folder', 'configs/')
121
+ self.config_file_path = path.normpath(path.join(self.config_file, os.pardir))
122
+ self.key_path = self.config.get('encryption', {}).get('folder', '<MANTIS>').replace('<MANTIS>', self.config_file_path)
123
+ self.configs_path = self.config.get('configs', {}).get('folder', '<MANTIS>/configs').replace('<MANTIS>', self.config_file_path)
124
+ self.environment_path = self.config.get('environment', {}).get('folder', '<MANTIS>/environments').replace('<MANTIS>', self.config_file_path)
125
+ self.compose_path = self.config.get('compose', {}).get('folder', '<MANTIS>/configs/compose').replace('<MANTIS>', self.config_file_path)
122
126
  self.compose_command = self.config.get('compose', {}).get('command', 'docker compose')
123
- self.compose_path = self.config.get('compose', {}).get('folder', 'configs/compose')
124
- self.key_file = path.join(f'{dirname(self.config_file)}', 'mantis.key')
125
-
127
+ self.key_file = path.normpath(path.join(self.key_path, 'mantis.key'))
128
+
126
129
  # Get environment settings
127
130
  self.PROJECT_NAME = self.config['project_name']
128
131
 
129
132
  def init_environment(self):
130
133
  self.env = Environment(
131
134
  environment_id=self.environment_id,
132
- folder=self.config.get('environment', {}).get('folder', 'environments'),
135
+ folder=self.environment_path,
133
136
  )
134
137
 
135
138
  # connection
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mantis-cli
3
- Version: 13.3.1
3
+ Version: 14.0.1
4
4
  Summary: Management command to build and deploy webapps, especially based on Django
5
5
  Home-page: https://github.com/PragmaticMates/mantis-cli
6
6
  Author: Erik Telepovský
@@ -1 +0,0 @@
1
- VERSION = '13.3.1'
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes