refactor: Update S3 file paths in server.js to use a new directory structure for better organization
Publish Fast Tabler Docker image / build-and-push-fast (push) Successful in 5m45s

This commit is contained in:
2025-07-14 22:17:41 +07:00
parent 24d4e743b5
commit 646e9be382
6 changed files with 76 additions and 10 deletions
+10 -10
View File
@@ -24,7 +24,7 @@ const s3 = new AWS.S3({
});
const BUCKET_NAME = process.env.S3_BUCKET_NAME;
const FILE_KEY = 'domains.txt';
const FILE_KEY = 'bgp_data/domains.txt';
// Get domains from S3
app.get('/api/domains', async (req, res) => {
@@ -82,7 +82,7 @@ app.post('/api/domains', async (req, res) => {
app.get('/api/asns', async (req, res) => {
const params = {
Bucket: BUCKET_NAME,
Key: 'asns.txt',
Key: 'bgp_data/asns.txt',
};
try {
@@ -112,7 +112,7 @@ app.post('/api/asns', async (req, res) => {
const params = {
Bucket: BUCKET_NAME,
Key: 'asns.txt',
Key: 'bgp_data/asns.txt',
Body: fileContent,
ContentType: 'text/plain',
};
@@ -132,7 +132,7 @@ app.post('/api/asns', async (req, res) => {
app.get('/api/domains-new', async (req, res) => {
const params = {
Bucket: BUCKET_NAME,
Key: 'domains_comunity.txt',
Key: 'bgp_data/domains_comunity.txt',
};
try {
@@ -162,7 +162,7 @@ app.post('/api/domains-new', async (req, res) => {
const params = {
Bucket: BUCKET_NAME,
Key: 'domains_comunity.txt',
Key: 'bgp_data/domains_comunity.txt',
Body: fileContent,
ContentType: 'text/plain',
};
@@ -182,7 +182,7 @@ app.post('/api/domains-new', async (req, res) => {
app.get('/api/ip-ranges', async (req, res) => {
const params = {
Bucket: BUCKET_NAME,
Key: 'domains/ips.txt',
Key: 'bgp_data/ips.txt',
};
try {
@@ -212,7 +212,7 @@ app.post('/api/ip-ranges', async (req, res) => {
const params = {
Bucket: BUCKET_NAME,
Key: 'domains/ips.txt',
Key: 'bgp_data/ips.txt',
Body: fileContent,
ContentType: 'text/plain',
};
@@ -368,9 +368,9 @@ app.post('/api/filters', async (req, res) => {
app.get('/api/s3/last-modified', async (req, res) => {
try {
const [domainsHead, domainsNewHead, asnsHead, serversHead, filtersHead] = await Promise.all([
s3.headObject({ Bucket: BUCKET_NAME, Key: 'domains.txt' }).promise(),
s3.headObject({ Bucket: BUCKET_NAME, Key: 'domains_comunity.txt' }).promise(),
s3.headObject({ Bucket: BUCKET_NAME, Key: 'asns.txt' }).promise(),
s3.headObject({ Bucket: BUCKET_NAME, Key: 'bgp_data/domains.txt' }).promise(),
s3.headObject({ Bucket: BUCKET_NAME, Key: 'bgp_data/domains_comunity.txt' }).promise(),
s3.headObject({ Bucket: BUCKET_NAME, Key: 'bgp_data/asns.txt' }).promise(),
s3.headObject({ Bucket: BUCKET_NAME, Key: 'servers.json' }).promise(),
s3.headObject({ Bucket: BUCKET_NAME, Key: 'filters.json' }).promise()
]);