Skip to content

Commit 088f4e5

Browse files
committed
Added option to avoid data/raw to be removed, need to be explicitly set
1 parent 3c0a17a commit 088f4e5

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

.env_example

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,16 @@
1111
#
1212
# DO NOT ADD THE REAL FILE TO VERSION CONTROL!
1313

14+
###### [config] ######
15+
# Uncomment if you want raw data to cleaned after processed.
16+
# Note that if you mount the zeek output folder as a volume inside the docker
17+
# image instead of manually copy those directories to the data/raw folder,
18+
# and if you enable this option, then AIP WILL REMOVE YOUR ZEEK FILES!!!
19+
# Use with care, and only if the data/raw/ folder contains a copy of the files
20+
# to be processed.
21+
# True, TRUE, true, TrUe are equivalent
22+
#remove_raw_data = 'true'
23+
1424
###### [secret] ######
1525
salt = 'mysecretsalt'
1626

lib/aip/data/functions.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,7 @@ def getrawdata(date):
6565
def removerawdata(date):
6666
dt.datetime.strptime(date, '%Y-%m-%d')
6767
p = path.join(_project_dir,'data','raw', date)
68-
shutil.rmtree(p)
68+
# Only delete raw data if explicitly allowed in the configuration file
69+
if _config['remove_raw_data'].lower() == 'true':
70+
shutil.rmtree(p)
71+

0 commit comments

Comments
 (0)