-
Notifications
You must be signed in to change notification settings - Fork 0
/
devbox.json
75 lines (75 loc) · 2.92 KB
/
devbox.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
{
"$schema": "https://raw.githubusercontent.com/jetify-com/devbox/0.13.6/.schema/devbox.schema.json",
"packages": {
"go": {
"version": "1.23.0",
"output": ["dev"]
},
"postgresql": {
"version": "latest"
},
"go-swag": {
"version": "1.8.12"
},
"go-migrate": {
"version": "latest"
}
},
"env": {
"ALLOWED_ORIGINS": "*",
"DB_HOST": "localhost",
"DB_PORT": "25432",
"DB_PORT_TEST": "35432",
"DB_USER": "postgres",
"DB_NAME": "icy_backend_local",
"DB_PASS": "postgres",
"DB_SSL_MODE": "disable",
"BTC_WALLET_WIF": "PRIVATE_KEY",
"BTC_BLOCKSTREAM_API_URL": "https://blockstream.info/testnet/api"
},
"shell": {
"scripts": {
"test": ["echo \"Error: no test specified\" && exit 1"],
"clean-db": [
"echo 'Removing PostgreSQL databases...'",
"rm -rf ./data/dev/*",
"rm -rf ./data/test/*",
"echo 'PostgreSQL databases removed successfully'"
],
"init-db": [
"echo 'Initializing PostgreSQL databases after cleanup...'",
"mkdir -p ./data/dev",
"mkdir -p ./data/test",
"chmod 700 ./data/dev",
"chmod 700 ./data/test",
"chown -R $(whoami) ./data/dev",
"chown -R $(whoami) ./data/test",
"initdb -D ./data/dev --username=$DB_USER --pwfile=<(echo '$DB_PASS') --encoding=UTF8 --locale=C --auth=trust --data-checksums",
"echo \"listen_addresses = '*'\" >> ./data/dev/postgresql.conf",
"echo \"port = $DB_PORT\" >> ./data/dev/postgresql.conf",
"echo \"host all all all trust\" >> ./data/dev/pg_hba.conf",
"pg_ctl -D ./data/dev -l ./data/dev/logfile start",
"createdb -h $DB_HOST -p $DB_PORT -U $DB_USER $DB_NAME",
"pg_ctl -D ./data/dev stop",
"initdb -D ./data/test --username=$DB_USER --pwfile=<(echo '$DB_PASS') --encoding=UTF8 --locale=C --auth=trust --data-checksums",
"echo \"listen_addresses = '*'\" >> ./data/test/postgresql.conf",
"echo \"port = $DB_PORT_TEST\" >> ./data/test/postgresql.conf",
"echo \"host all all all trust\" >> ./data/test/pg_hba.conf",
"pg_ctl -D ./data/test -l ./data/test/logfile start",
"createdb -h $DB_HOST -p $DB_PORT_TEST -U $DB_USER ${DB_NAME}_test",
"pg_ctl -D ./data/test stop",
"echo 'PostgreSQL databases initialized successfully'"
],
"migrate-up": [
"echo 'Migrating PostgreSQL databases...'",
"migrate -path ./migrations/schema -database postgres://$DB_USER:$DB_PASS@$DB_HOST:$DB_PORT/$DB_NAME?sslmode=$DB_SSL_MODE up",
"echo 'PostgreSQL databases migrated successfully'"
],
"migrate-down": [
"echo 'Rolling back PostgreSQL migration...'",
"migrate -path ./migrations/schema -database postgres://$DB_USER:$DB_PASS@$DB_HOST:$DB_PORT/$DB_NAME?sslmode=$DB_SSL_MODE down -all",
"echo 'PostgreSQL migration rollback completed successfully'"
]
}
}
}