Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
aura-engine
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lars Kruse
aura-engine
Commits
dc40738a
Commit
dc40738a
authored
5 years ago
by
David Trattnig
Browse files
Options
Downloads
Patches
Plain Diff
Automatic config detection for production-envs.
parent
2ea1a22c
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
aura.py
+6
-7
6 additions, 7 deletions
aura.py
guru.py
+2
-2
2 additions, 2 deletions
guru.py
libraries/base/config.py
+23
-1
23 additions, 1 deletion
libraries/base/config.py
with
31 additions
and
10 deletions
aura.py
+
6
−
7
View file @
dc40738a
...
...
@@ -42,12 +42,11 @@ from libraries.base.logger import AuraLogger
from
libraries.base.config
import
AuraConfig
def
get_config_file
():
if
len
(
sys
.
argv
)
>=
3
and
"
--config-file
"
in
sys
.
argv
:
idx
=
sys
.
argv
.
index
(
"
--config-file
"
)
return
sys
.
argv
[
idx
+
1
]
else
:
return
"
%s/configuration/engine.ini
"
%
Path
(
__file__
).
parent
.
absolute
()
# def get_config_file():
# if len(sys.argv) >= 3 and "--config-file" in sys.argv:
# idx = sys.argv.index("--config-file")
# return sys.argv[idx + 1]
def
get_database_uri
():
db_name
=
config
.
get
(
"
db_name
"
)
...
...
@@ -64,7 +63,7 @@ def configure_flask():
app
.
config
[
'
SQLALCHEMY_TRACK_MODIFICATIONS
'
]
=
False
config
=
AuraConfig
(
get_config_file
()
)
config
=
AuraConfig
()
app
=
Flask
(
__name__
,
template_folder
=
config
.
get
(
"
install_dir
"
)
+
"
/modules/web/templates
"
)
configure_flask
()
DB
=
SQLAlchemy
(
app
)
...
...
This diff is collapsed.
Click to expand it.
guru.py
+
2
−
2
View file @
dc40738a
...
...
@@ -41,8 +41,8 @@ class Guru():
"""
Command Line Interface (CLI) for Aura Engine.
"""
config_path
=
"
%s/configuration/engine.ini
"
%
Path
(
__file__
).
parent
.
absolute
()
config
=
AuraConfig
(
config_path
)
#
config_path = "%s/configuration/engine.ini" % Path(__file__).parent.absolute()
config
=
AuraConfig
()
parser
=
None
args
=
None
...
...
This diff is collapsed.
Click to expand it.
libraries/base/config.py
+
23
−
1
View file @
dc40738a
...
...
@@ -23,21 +23,43 @@
#
import
os
import
os.path
import
sys
import
logging
from
pathlib
import
Path
from
configparser
import
ConfigParser
class
AuraConfig
:
"""
AuraConfig Class
Holds the Aura Configuration as in the file `engine.ini`.
"""
ini_path
=
""
logger
=
None
def
__init__
(
self
,
ini_path
):
# = "/etc/aura/engine.ini"):
def
__init__
(
self
,
ini_path
=
"
/etc/aura/engine.ini
"
):
"""
Initializes the configuration, defaults to `/etc/aura/engine.ini`.
If this file doesn
'
t exist it uses `./configuration/engine.ini` from
the project directory.
Args:
ini_path(String): The path to the configuration file `engine.ini`
"""
config_file
=
Path
(
ini_path
)
if
not
config_file
.
is_file
():
ini_path
=
"
%s/configuration/engine.ini
"
%
Path
(
__file__
).
parent
.
parent
.
parent
.
absolute
()
self
.
ini_path
=
ini_path
self
.
logger
=
logging
.
getLogger
(
"
AuraEngine
"
)
self
.
load_config
()
def
set
(
self
,
key
,
value
):
"""
Set a property
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment