- Removing unused .env files
Opting now for config.json files as they better interoperability between node and rust + Hardcoding some variables into build-db.sh This really shouldn't be an issue however + using cat to dump out what table structures are being setup due to strange bugs in pipeline
This commit is contained in:
parent
96bdd70cd5
commit
83f846640c
@ -187,7 +187,7 @@ full-mock-tests:
|
||||
- pushd json-api/
|
||||
# Yes i know this looks kinda wack but hopefully cargo won't try to reuild if just
|
||||
# use the binary directly
|
||||
- target/release/json-api -H ../hmac.secret -w ../wss-hmac.secret -s&
|
||||
- cargo run --release -- -H ../hmac.secret -w ../wss-hmac.secret -s&
|
||||
- popd
|
||||
- sleep 5
|
||||
# TODO: do some kind of more intelligent logging here (maybe some integrations or something idk)
|
||||
|
@ -1,19 +0,0 @@
|
||||
DATABASE_URL=mysql://freechat_dev:password@localhost:3306/freechat
|
||||
DATABASE_NAME=freechat
|
||||
DATABASE_PASS=password
|
||||
DATABASE_USER=freechat_dev
|
||||
DATABASE_HOST=localhost
|
||||
DATABASE_PORT=3306
|
||||
|
||||
# Note that these should literally never point to the same file
|
||||
# that completely breaks the web socket's permissions+authentication model
|
||||
HMAC_PATH=hmac.secret
|
||||
WSS_HMAC_PATH=wss-hmac.secret
|
||||
|
||||
|
||||
# Server meta things
|
||||
SERVER_NAME="Freechat Dev Server"
|
||||
SERVER_DESCRIPTION="Server for sick development things"
|
||||
# NOTE: most clients shouldn't expect these to end with a slash
|
||||
PUBLIC_URL=http://localhost:4536
|
||||
PUBLIC_WS_URL=ws://localhost:5648
|
@ -26,7 +26,7 @@ def create_admin() -> Admin :
|
||||
CARGO_BIN = os.getenv('CARGO_BIN')
|
||||
|
||||
proc = subprocess.run(
|
||||
f'cargo run --release -- -c python-tester'.split(),
|
||||
f'cargo run --release -- -c ../config.json'.split(),
|
||||
text=True, capture_output=True
|
||||
)
|
||||
try:
|
||||
|
@ -14,42 +14,16 @@ if [ ! $1 ];then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! $2 ];then
|
||||
echo Failure: Insufficient arguments provided
|
||||
echo ./build-db.sh /migrations/folder/path /path/to/.env file
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Log paths
|
||||
migration_logs=sql-migration.log
|
||||
|
||||
migration_loc=$1
|
||||
env_path=$2
|
||||
|
||||
source $env_path
|
||||
|
||||
# This is kinda dumb but we have to check and make sure the sample default user
|
||||
# configuration is all there
|
||||
if [ ! $DATABASE_NAME ];then
|
||||
echo No DATABASE_NAME set
|
||||
exit 1
|
||||
fi
|
||||
if [ ! $DATABASE_PASS ];then
|
||||
echo No DATABASE_PASS set
|
||||
exit 1
|
||||
fi
|
||||
if [ ! $DATABASE_USER ];then
|
||||
echo No DATABASE_USER set
|
||||
exit 1
|
||||
fi
|
||||
if [ ! $DATABASE_HOST ];then
|
||||
echo No DATABASE_HOST set
|
||||
exit 1
|
||||
fi
|
||||
if [ ! $DATABASE_PORT ];then
|
||||
echo No DATABASE_PORT set
|
||||
exit 1
|
||||
fi
|
||||
# Running defaults here because there's no point in protecting dummy data
|
||||
DATABASE_NAME=freechat
|
||||
DATABASE_PASS=password
|
||||
DATABASE_USER=freechat_dev
|
||||
DATABASE_HOST=localhost
|
||||
|
||||
# Next we setup the database user
|
||||
mysql -e "CREATE USER '$DATABASE_USER'@'$DATABASE_HOST' IDENTIFIED BY '$DATABASE_PASS';" \
|
||||
@ -65,6 +39,8 @@ for dir in $(ls $migration_loc);do
|
||||
# Port field is ignored in this script as its straight up not used in Docker tests
|
||||
# NOTE: there should **not** be a space between -p and the database password
|
||||
echo Migrating $migration_loc/$dir
|
||||
cat $migration_loc/$dir/up.sql
|
||||
|
||||
mysql -u $DATABASE_USER -p$DATABASE_PASS \
|
||||
-h $DATABASE_HOST -D $DATABASE_NAME \
|
||||
< $migration_loc/$dir/up.sql >> $migration_logs 2>&1
|
||||
|
Loading…
Reference in New Issue
Block a user