Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
app_install
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
tarun.madamanchi
app_install
Commits
74017bf2
Commit
74017bf2
authored
Jan 05, 2024
by
tarun2512
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
second commit
parent
7088b4d6
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
11 deletions
+5
-11
.env
.env
+0
-1
app_clone_script.py
app_clone_script.py
+5
-10
No files found.
.env
View file @
74017bf2
...
...
@@ -5,6 +5,5 @@ USER_ID=fpWx7Aw4NJzzXWxcE6w5dU
PROJECT_ID=project_287
APP_NAME=FT Energy Manager
PREFIX=project_287
ZIP_NAME=FT Energy Manager.zip
BASE_PATH=/code/data
MOUNT_DIR=app_zip
\ No newline at end of file
app_clone_script.py
View file @
74017bf2
import
logging
from
pymongo
import
MongoClient
import
time
import
shutil
from
dotenv
import
load_dotenv
import
os
import
json
load_dotenv
()
import
sys
import
zipfile
import
httpx
from
app_clone_script_helper
import
CloneScriptHelper
...
...
@@ -22,7 +18,6 @@ USER_ID = os.environ.get("USER_ID")
PROJECT_ID
=
os
.
environ
.
get
(
"PROJECT_ID"
)
APP_NAME
=
os
.
environ
.
get
(
"APP_NAME"
)
PREFIX
=
os
.
environ
.
get
(
"PREFIX"
)
ZIP_NAME
=
os
.
environ
.
get
(
"ZIP_NAME"
)
BASE_PATH
=
os
.
environ
.
get
(
"BASE_PATH"
)
MOUNT_DIR
=
os
.
environ
.
get
(
"MOUNT_DIR"
)
...
...
@@ -215,12 +210,12 @@ def push_app(folder_path, folder_name, user_id, project_id, prefix=None):
connection
.
customer_apps
.
update_one
(
query
,
{
"$set"
:
data
},
upsert
=
True
)
def
push_data
(
app_name
,
folder_name
,
user_id
,
project_id
,
prefix
=
None
):
def
push_data
(
zip_path
,
folder_name
,
user_id
,
project_id
,
prefix
=
None
):
folder_split_data
=
folder_name
.
split
(
"."
)
connection
=
Connection
()
user_details
=
connection
.
user_conn
.
find_one
({
"user_id"
:
user_id
},
{
"_id"
:
0
})
collection_name
=
folder_split_data
[
1
]
folder_path
=
os
.
path
.
join
(
app_name
,
folder_name
)
folder_path
=
os
.
path
.
join
(
zip_path
,
folder_name
)
if
collection_name
==
"category"
:
push_category
(
folder_path
,
folder_name
,
project_id
,
prefix
)
elif
collection_name
==
"widget"
:
...
...
@@ -235,14 +230,14 @@ def push_data(app_name, folder_name, user_id, project_id, prefix=None):
push_lookups
(
folder_path
,
folder_name
,
prefix
)
def
extract_app_zip
(
app_
zip_name
,
app_
name
,
user_id
,
project_id
,
prefix
=
None
):
def
extract_app_zip
(
app_name
,
user_id
,
project_id
,
prefix
=
None
):
zip_path
=
os
.
path
.
join
(
BASE_PATH
,
MOUNT_DIR
,
f
"{app_name}.zip"
)
CloneScriptHelper
()
.
unzip_file
(
zip_path
,
zip_path
)
folders_list
=
CloneScriptHelper
()
.
list_folders
(
app_name
)
folders_list
=
CloneScriptHelper
()
.
list_folders
(
zip_path
)
for
folder
in
folders_list
:
if
folder
in
[
"app_image"
,
"app_logo"
]:
continue
push_data
(
app_name
,
folder
,
user_id
,
project_id
,
prefix
)
push_data
(
zip_path
,
folder
,
user_id
,
project_id
,
prefix
)
if
__name__
==
"__main__"
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment