Skip to content

Commit 136ff44

Browse files
authored
Merge pull request #3 from script-logic/feature/config
feat: config + logger
2 parents 36af61d + d6ec136 commit 136ff44

20 files changed

Lines changed: 2216 additions & 33 deletions

.dockerignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ __pycache__/
1010
.env.*
1111
.pytest_cache/
1212
.vscode/
13+
tree.py
1314

1415
# pytest
1516
.pytest_cache/
@@ -44,6 +45,9 @@ __pycache__/
4445
.venv/
4546
venv/
4647
env/
48+
.env
49+
.env.local
50+
.env.*.local
4751

4852
# IDEs
4953
.vscode/

.env.example

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,25 @@
1-
test
1+
# Database Configuration
2+
DATABASE__HOST=localhost
3+
DATABASE__PORT=5432
4+
DATABASE__USER=postgres
5+
DATABASE__PASSWORD=your_secure_password
6+
DATABASE__DB=deribit_tracker
7+
8+
# Deribit API Configuration
9+
DERIBIT_API__CLIENT_ID=your_client_id
10+
DERIBIT_API__CLIENT_SECRET=your_client_secret
11+
DERIBIT_API__BASE_URL=https://www.deribit.com/api/v2
12+
13+
# Redis Configuration
14+
REDIS__HOST=localhost
15+
REDIS__PORT=6379
16+
REDIS__DB=0
17+
18+
# Application Configuration
19+
APPLICATION__DEBUG=False
20+
APPLICATION__API_V1_PREFIX=/api/v1
21+
APPLICATION__PROJECT_NAME=Deribit Price Tracker API
22+
APPLICATION__VERSION=0.2.0
23+
24+
# CORS Configuration
25+
CORS__ORIGINS=["http://localhost:8000","http://127.0.0.1:8000"]

.github/workflows/ci.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,38 @@ jobs:
2727
pip install poetry
2828
poetry config virtualenvs.create false
2929
30+
- name: Create .env file for tests
31+
run: |
32+
cat > .env << 'EOF'
33+
# Database Configuration
34+
DATABASE__HOST=localhost
35+
DATABASE__PORT=5432
36+
DATABASE__USER=test_user
37+
DATABASE__PASSWORD=test_password
38+
DATABASE__DB=test_db
39+
40+
# Deribit API Configuration
41+
DERIBIT_API__CLIENT_ID=test_client_id
42+
DERIBIT_API__CLIENT_SECRET=test_client_secret
43+
44+
# Redis Configuration
45+
REDIS__HOST=localhost
46+
REDIS__PORT=6379
47+
REDIS__DB=0
48+
49+
# Application Configuration
50+
APPLICATION__DEBUG=false
51+
APPLICATION__API_V1_PREFIX=/api/v1
52+
APPLICATION__PROJECT_NAME=Deribit Price Tracker Test
53+
APPLICATION__VERSION=1.0.0
54+
55+
# CORS Configuration
56+
CORS__ORIGINS=["http://localhost:8000"]
57+
EOF
58+
59+
echo "=== Created .env file ==="
60+
cat .env
61+
3062
- name: Install dependencies
3163
run: poetry install --with dev
3264

@@ -67,6 +99,16 @@ jobs:
6799
steps:
68100
- uses: actions/checkout@v4
69101

102+
- name: Create .env file for security checks
103+
run: |
104+
cat > .env << 'EOF'
105+
DATABASE__HOST=localhost
106+
DATABASE__PORT=5432
107+
DATABASE__USER=test_user
108+
DATABASE__PASSWORD=test_password
109+
DATABASE__DB=test_db
110+
EOF
111+
70112
- name: Run security scan
71113
run: |
72114
pip install bandit safety

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Environment
22
.env
33
.env.local
4+
.env.*.local
45

56
# Credentials
67
credentials/
@@ -64,6 +65,7 @@ venv.bak/
6465
*.swo
6566
*~
6667
.ruff_cache
68+
tree.py
6769

6870
# OS
6971
.DS_Store

.gitlab-ci.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,31 @@ before_script:
1919
- pip install poetry==$POETRY_VERSION
2020
- poetry config virtualenvs.create true
2121
- poetry config virtualenvs.in-project true
22+
- |
23+
@'
24+
DATABASE__HOST=localhost
25+
DATABASE__PORT=5432
26+
DATABASE__USER=test_user
27+
DATABASE__PASSWORD=test_password
28+
DATABASE__DB=test_db
29+
30+
DERIBIT_API__CLIENT_ID=test_client_id
31+
DERIBIT_API__CLIENT_SECRET=test_client_secret
32+
33+
REDIS__HOST=localhost
34+
REDIS__PORT=6379
35+
REDIS__DB=0
36+
37+
APPLICATION__DEBUG=false
38+
APPLICATION__API_V1_PREFIX=/api/v1
39+
APPLICATION__PROJECT_NAME=Deribit Price Tracker Test
40+
APPLICATION__VERSION=1.0.0
41+
42+
CORS__ORIGINS=["http://localhost:8000"]
43+
'@ | Out-File -FilePath .env -Encoding UTF8
44+
45+
Write-Host "=== Created .env file ==="
46+
Get-Content .env
2247
- poetry install --with dev
2348

2449
test:
@@ -40,6 +65,15 @@ test:
4065

4166
security:
4267
stage: security
68+
before_script:
69+
- |
70+
@'
71+
DATABASE__HOST=localhost
72+
DATABASE__PORT=5432
73+
DATABASE__USER=test_user
74+
DATABASE__PASSWORD=test_password
75+
DATABASE__DB=test_db
76+
'@ | Out-File -FilePath .env -Encoding UTF8
4377
script:
4478
- pip install bandit
4579
- bandit -r . -c .bandit.yml -f json -o bandit-report.json

.pre-commit-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,4 @@ repos:
2424
rev: v1.5.0
2525
hooks:
2626
- id: detect-secrets
27+
args: ['--baseline', '.secrets.baseline']

.secrets.baseline

Lines changed: 211 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,211 @@
1+
{
2+
"version": "1.5.0",
3+
"plugins_used": [
4+
{
5+
"name": "ArtifactoryDetector"
6+
},
7+
{
8+
"name": "AWSKeyDetector"
9+
},
10+
{
11+
"name": "AzureStorageKeyDetector"
12+
},
13+
{
14+
"name": "Base64HighEntropyString",
15+
"limit": 4.5
16+
},
17+
{
18+
"name": "BasicAuthDetector"
19+
},
20+
{
21+
"name": "CloudantDetector"
22+
},
23+
{
24+
"name": "DiscordBotTokenDetector"
25+
},
26+
{
27+
"name": "GitHubTokenDetector"
28+
},
29+
{
30+
"name": "GitLabTokenDetector"
31+
},
32+
{
33+
"name": "HexHighEntropyString",
34+
"limit": 3.0
35+
},
36+
{
37+
"name": "IbmCloudIamDetector"
38+
},
39+
{
40+
"name": "IbmCosHmacDetector"
41+
},
42+
{
43+
"name": "IPPublicDetector"
44+
},
45+
{
46+
"name": "JwtTokenDetector"
47+
},
48+
{
49+
"name": "KeywordDetector",
50+
"keyword_exclude": ""
51+
},
52+
{
53+
"name": "MailchimpDetector"
54+
},
55+
{
56+
"name": "NpmDetector"
57+
},
58+
{
59+
"name": "OpenAIDetector"
60+
},
61+
{
62+
"name": "PrivateKeyDetector"
63+
},
64+
{
65+
"name": "PypiTokenDetector"
66+
},
67+
{
68+
"name": "SendGridDetector"
69+
},
70+
{
71+
"name": "SlackDetector"
72+
},
73+
{
74+
"name": "SoftlayerDetector"
75+
},
76+
{
77+
"name": "SquareOAuthDetector"
78+
},
79+
{
80+
"name": "StripeDetector"
81+
},
82+
{
83+
"name": "TelegramBotTokenDetector"
84+
},
85+
{
86+
"name": "TwilioKeyDetector"
87+
}
88+
],
89+
"filters_used": [
90+
{
91+
"path": "detect_secrets.filters.allowlist.is_line_allowlisted"
92+
},
93+
{
94+
"path": "detect_secrets.filters.common.is_ignored_due_to_verification_policies",
95+
"min_level": 2
96+
},
97+
{
98+
"path": "detect_secrets.filters.heuristic.is_indirect_reference"
99+
},
100+
{
101+
"path": "detect_secrets.filters.heuristic.is_likely_id_string"
102+
},
103+
{
104+
"path": "detect_secrets.filters.heuristic.is_lock_file"
105+
},
106+
{
107+
"path": "detect_secrets.filters.heuristic.is_not_alphanumeric_string"
108+
},
109+
{
110+
"path": "detect_secrets.filters.heuristic.is_potential_uuid"
111+
},
112+
{
113+
"path": "detect_secrets.filters.heuristic.is_prefixed_with_dollar_sign"
114+
},
115+
{
116+
"path": "detect_secrets.filters.heuristic.is_sequential_string"
117+
},
118+
{
119+
"path": "detect_secrets.filters.heuristic.is_swagger_file"
120+
},
121+
{
122+
"path": "detect_secrets.filters.heuristic.is_templated_secret"
123+
}
124+
],
125+
"results": {
126+
".github\\workflows\\ci.yml": [
127+
{
128+
"type": "Secret Keyword",
129+
"filename": ".github\\workflows\\ci.yml",
130+
"hashed_secret": "da64b94ccfb1a5e2a598831ed28878c880f60dfc",
131+
"is_verified": false,
132+
"line_number": 31
133+
},
134+
{
135+
"type": "Secret Keyword",
136+
"filename": ".github\\workflows\\ci.yml",
137+
"hashed_secret": "dc5f72fcc64e44ece1aa8dfab21ddfce0fc8772b",
138+
"is_verified": false,
139+
"line_number": 103
140+
}
141+
],
142+
"app\\core\\config.py": [
143+
{
144+
"type": "Basic Auth Credentials",
145+
"filename": "app\\core\\config.py",
146+
"hashed_secret": "5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8",
147+
"is_verified": false,
148+
"line_number": 54
149+
}
150+
],
151+
"tests\\test_config.py": [
152+
{
153+
"type": "Secret Keyword",
154+
"filename": "tests\\test_config.py",
155+
"hashed_secret": "e5e9fa1ba31ecd1ae84f75caaa474f3a663f05f4",
156+
"is_verified": false,
157+
"line_number": 33
158+
},
159+
{
160+
"type": "Secret Keyword",
161+
"filename": "tests\\test_config.py",
162+
"hashed_secret": "c94d65f02a652d11c2e5c2e1ccf38dce5a076e1e",
163+
"is_verified": false,
164+
"line_number": 74
165+
},
166+
{
167+
"type": "Basic Auth Credentials",
168+
"filename": "tests\\test_config.py",
169+
"hashed_secret": "c94d65f02a652d11c2e5c2e1ccf38dce5a076e1e",
170+
"is_verified": false,
171+
"line_number": 79
172+
},
173+
{
174+
"type": "Secret Keyword",
175+
"filename": "tests\\test_config.py",
176+
"hashed_secret": "1adfce9fa4bc6b1cbdf95ac2dc6180175da7558b",
177+
"is_verified": false,
178+
"line_number": 90
179+
},
180+
{
181+
"type": "Secret Keyword",
182+
"filename": "tests\\test_config.py",
183+
"hashed_secret": "72cb70dbbafe97e5ea13ad88acd65d08389439b0",
184+
"is_verified": false,
185+
"line_number": 122
186+
},
187+
{
188+
"type": "Secret Keyword",
189+
"filename": "tests\\test_config.py",
190+
"hashed_secret": "ee27c133da056b1013f88c712f92460bc7b3c90a",
191+
"is_verified": false,
192+
"line_number": 130
193+
},
194+
{
195+
"type": "Secret Keyword",
196+
"filename": "tests\\test_config.py",
197+
"hashed_secret": "a94a8fe5ccb19ba61c4c0873d391e987982fbbd3",
198+
"is_verified": false,
199+
"line_number": 241
200+
},
201+
{
202+
"type": "Secret Keyword",
203+
"filename": "tests\\test_config.py",
204+
"hashed_secret": "fca268ae2442d5cabc3e12d87b349adf8bf7d76c",
205+
"is_verified": false,
206+
"line_number": 373
207+
}
208+
]
209+
},
210+
"generated_at": "2026-01-23T18:44:37Z"
211+
}

0 commit comments

Comments
 (0)