Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert to Pixie #67

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# SCM syntax highlighting
pixi.lock linguist-language=YAML linguist-generated=true
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,7 @@ bro_connector/qc_tool/app/assets/.mapbox_access_token
bro_connector/static/dash/.mapbox_access_token
**/.venv
bro_connector/.pi_cache/

# pixi environments
.pixi
*.egg-info
2 changes: 1 addition & 1 deletion bro_connector/gld/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@ def on_delete_measurement_tvp(sender, instance: MeasurementTvp, **kwargs):
metadata.delete()

@receiver(pre_save, sender=MeasurementTvp)
def on_save_measurement_tvp(sender, instance: MeasurementTvp, **kwargs):
def pre_save_measurement_tvp(sender, instance: MeasurementTvp, **kwargs):
if not instance.calculated_value and instance.field_value:
instance.calculated_value = _calculate_value(instance.field_value, instance.field_value_unit)
70 changes: 45 additions & 25 deletions bro_connector/installation_help/install.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -110,42 +110,62 @@ if /I "%confirm%" EQU "yes" (
"%PGADMIN_PATH%\psql" -U %PGUSER% -h %PGHOST% -p %PGPORT% -d %PGDATABASE% -f %SQL_FILE_PATH%
)

REM Read values from files
set /p FERNET_KEY=<%CUR_DIR%\fernet_key.txt
set /p SALT_STRING=<%CUR_DIR%\salt.txt

copy %CUR_DIR%\..\main\localsecret_template.py %CUR_DIR%\..\main\localsecret.py
echo "%FERNET_KEY%"
echo "%SALT_STRING%"
echo %CUR_DIR%
pause

REM Replace placeholders in the copied file with the actual values
REM Create the file with placeholders
(
echo # FTP server details
echo ftp_ip = ''
echo ftp_username = ''
echo ftp_password = ''
echo ftp_path = ''
echo # Constants and sensitive keys
echo FERNET_ENCRYPTION_KEY = "%FERNET_KEY%"
echo SALT_STRING = "%SALT_STRING%"
echo.
echo # Datbasename
echo database = "%PGDATABASE%"
echo # Environment configuration
echo env = "development"
echo.
echo # Production db settings
echo p_user = "%PGUSER%"
echo p_password = "%PGPASSWORD%"
echo p_host = "%PGHOST%"
echo p_port = "%PGPORT%"
echo # FTP server details
echo ftp_ip = 'ftp.example.com'
echo ftp_username = 'your_username'
echo ftp_password = 'your_password'
echo.
echo # Test db settings
echo t_user = "%PGUSER%"
echo t_password = "%PGPASSWORD%"
echo t_host = "%PGHOST%"
echo t_port = "%PGPORT%"
echo # FTP paths
echo ftp_frd_path = '/FRD'
echo ftp_gld_path = '/GLD'
echo ftp_maintenance_path = '/ONDERHOUD'
echo ftp_gar_path = '/GAR'
echo.
echo # Staging db settings
echo s_user = "%PGUSER%"
echo s_password = "%PGPASSWORD%"
echo s_host = "%PGHOST%"
echo s_port = "%PGPORT%"
echo # Database name
echo database = "db_bro_connector"
echo.
echo # Database settings based on environment
echo if env == "production":
echo user = ""
echo password = ""
echo host = ""
echo port = ""
echo elif env == "staging":
echo user = ""
echo password = ""
echo host = ""
echo port = ""
echo else:
echo user = "postgres"
echo password = "postgres"
echo host = "localhost"
echo port = "5432"
echo.
echo # Lizard keys
echo validation_key = "%VALIDATION_KEY%"
echo validation_key = ""
) > %CUR_DIR%\..\main\localsecret.py

del %CUR_DIR%\salt.txt
del %CUR_DIR%\fernet_key.txt

echo Warning! Currently all settings [production, staging and test] point to the same database. Correct this if wanted in the folder bro_connector/main/localsecret.py

pause
Expand Down
46 changes: 27 additions & 19 deletions bro_connector/main/localsecret_template.py
Original file line number Diff line number Diff line change
@@ -1,32 +1,40 @@
# FERNET_ENCRYPTION_KEY = ""
# SALT_STRING = ""

# FTP server details
# env = "development"

# # FTP server details
# ftp_ip = 'ftp.example.com'
# ftp_username = 'your_username'
# ftp_password = 'your_password'
# ftp_path = '/path/to/ftp/directory'

# # Paths
# ftp_frd_path = '/FRD'
# ftp_gld_path = '/GLD'
# ftp_maintenance_path = '/ONDERHOUD'
# ftp_gar_path = '/GAR'

# # Datbasename
# database = ""

# if env == "production":
# # Production db settings
# p_user = ""
# p_password = ""
# p_host = ""
# p_port = ""

# # Test db settings
# t_user = ""
# t_password = ""
# t_host = ""
# t_port = ""

# # Staging db settings
# s_user = ""
# s_password = ""
# s_host = ""
# s_port = ""
# user = ''
# password = ''
# host = ''
# port = ''
# elif env == "staging":
# # Test db settings
# user = ''
# password = ''
# host = ''
# port = ''
# else:
# # Staging db settings
# user = 'postgres'
# password = 'postgres'
# host = 'localhost'
# port = '5432'

# Lizard keys
# # Lizard keys
# validation_key = ""
Loading