Skip to content
Merged
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
13 changes: 11 additions & 2 deletions api/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ NODE_ENV=development

# Database Configuration (Debian Server)
# Option 1: Use DATABASE_URL (PostgreSQL connection string)
# The api-user is stac_api (read-only) (stac_crawler for crawler-group)
# The api-user is stac_api (read-only)
DATABASE_URL=postgresql://stac_api:[PASSWORD]@atlas.stacindex.org:5432/stac_db

# Option 2: Use individual variables (currently active)
DB_HOST=atlas.stacindex.org
DB_PORT=5433 # 5432 for production
DB_PORT=5430 # 5432 for production
DB_NAME=stac_db
DB_USER=stac_api
DB_PASSWORD= # Add stac_api password here (api_password)
Expand All @@ -33,3 +33,12 @@ LOG_LEVEL=debug
API_TITLE=STAC Atlas
API_DESCRIPTION=A centralized platform for managing, indexing, and providing STAC Collection metadata
API_VERSION=1.0.0

# Request Size Limits
# MAX_URL_LENGTH: Maximum URL length including query parameters (default: 1MB)
# MAX_HEADER_SIZE: Maximum total size of all HTTP headers (default: 100KB)
# MAX_BODY_SIZE: Maximum request body size for POST/PUT (default: 10MB)
# Formats: "100KB", "1MB", "10MB", etc.
MAX_URL_LENGTH=1MB
MAX_HEADER_SIZE=100KB
MAX_BODY_SIZE=10MB
11 changes: 1 addition & 10 deletions api/__tests__/buildCollectionSearchQuery.aggregates.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ describe('buildCollectionSearchQuery - aggregated fields', () => {
// Core collection fields should be prefixed with 'c.'
expect(sql).toMatch(/c\.id/);
expect(sql).toMatch(/c\.stac_version/);
expect(sql).toMatch(/c\.type/);
expect(sql).toMatch(/c\.title/);
expect(sql).toMatch(/c\.description/);
expect(sql).toMatch(/c\.license/);
Expand All @@ -30,7 +29,6 @@ describe('buildCollectionSearchQuery - aggregated fields', () => {
expect(sql).toMatch(/prov\.providers/);
expect(sql).toMatch(/a\.assets/);
expect(sql).toMatch(/s\.summaries/);
expect(sql).toMatch(/cl\.last_crawled/);
});

test('FROM clause uses collection alias c', () => {
Expand Down Expand Up @@ -94,13 +92,6 @@ describe('buildCollectionSearchQuery - aggregated fields', () => {
expect(sql).toMatch(/WHERE cs\.collection_id = c\.id/);
});

test('includes LATERAL JOIN for last_crawled timestamp', () => {
const { sql } = buildCollectionSearchQuery({ limit: 10, token: 0 });

expect(sql).toMatch(/MAX\(clc\.last_crawled\) AS last_crawled/);
expect(sql).toMatch(/FROM crawllog_collection clc/);
expect(sql).toMatch(/WHERE clc\.collection_id = c\.id/);
});
});

describe('WHERE clauses use collection alias c', () => {
Expand Down Expand Up @@ -214,7 +205,7 @@ describe('buildCollectionSearchQuery - aggregated fields', () => {
// Count LEFT JOIN LATERAL occurrences (should be 6: kw, ext, prov, a, s, cl)
const leftJoinLateralCount = (sql.match(/LEFT JOIN LATERAL/gi) || []).length;

expect(leftJoinLateralCount).toBe(6);
expect(leftJoinLateralCount).toBe(5);
});
});
});
16 changes: 0 additions & 16 deletions api/__tests__/buildCollectionSearchQuery.integration.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ describe('Integration: Collection Search with Aggregated Fields', () => {
expect(firstRow).toHaveProperty('providers');
expect(firstRow).toHaveProperty('assets');
expect(firstRow).toHaveProperty('summaries');
expect(firstRow).toHaveProperty('last_crawled');
}
});
});
Expand Down Expand Up @@ -138,19 +137,6 @@ describe('Integration: Collection Search with Aggregated Fields', () => {
}
});
});

test('last_crawled should be timestamp or null', async () => {
const { sql, values } = buildCollectionSearchQuery({ limit: 10, token: 0 });
const result = await query(sql, values);

result.rows.forEach(row => {
if (row.last_crawled !== null) {
// Should be a valid Date or parseable timestamp
const date = new Date(row.last_crawled);
expect(date.toString()).not.toBe('Invalid Date');
}
});
});
});

describe('Filter Compatibility with Aggregated Fields', () => {
Expand Down Expand Up @@ -179,7 +165,6 @@ describe('Integration: Collection Search with Aggregated Fields', () => {
result.rows.forEach(row => {
expect(row).toHaveProperty('stac_extensions');
expect(row).toHaveProperty('summaries');
expect(row).toHaveProperty('last_crawled');
});
});

Expand Down Expand Up @@ -212,7 +197,6 @@ describe('Integration: Collection Search with Aggregated Fields', () => {
expect(row).toHaveProperty('providers');
expect(row).toHaveProperty('assets');
expect(row).toHaveProperty('summaries');
expect(row).toHaveProperty('last_crawled');
});
});
});
Expand Down
Loading
Loading