Skip to content

feat: add SKIP_BUILD_GEO env variable#4006

Open
diogotcorreia wants to merge 1 commit intoumami-software:devfrom
diogotcorreia:env-skip-build-geo
Open

feat: add SKIP_BUILD_GEO env variable#4006
diogotcorreia wants to merge 1 commit intoumami-software:devfrom
diogotcorreia:env-skip-build-geo

Conversation

@diogotcorreia
Copy link
Contributor

Closes #4004

@vercel
Copy link

vercel bot commented Feb 6, 2026

@diogotcorreia is attempting to deploy a commit to the umami-software Team on Vercel.

A member of the Team first needs to authorize it.

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 6, 2026

Greptile Overview

Greptile Summary

This PR adds a new SKIP_BUILD_GEO environment variable that allows users to skip the geo database download and setup during the build process. The check is placed at the beginning of the script, before the existing Vercel environment check.

Key Changes:

  • Added conditional check for SKIP_BUILD_GEO environment variable at the top of scripts/build-geo.js
  • When set, the script logs a message and exits with code 0, bypassing the entire geo database setup
  • Follows the same pattern as the existing VERCEL environment check

Use Case:
This is useful for environments where geo location features are not needed, reducing build time and avoiding unnecessary downloads of the GeoLite2 database.

Confidence Score: 5/5

  • This PR is safe to merge with no risks
  • The change is minimal and follows existing patterns in the codebase. It adds a simple environment variable check that exits early if set, identical in structure to the existing Vercel check. No logic changes to the download functionality, and the implementation is straightforward and non-breaking.
  • No files require special attention

Important Files Changed

Filename Overview
scripts/build-geo.js Added SKIP_BUILD_GEO environment variable to allow skipping geo database setup

Sequence Diagram

sequenceDiagram
    participant Build as Build Process
    participant Script as build-geo.js
    participant Env as Environment Variables
    participant HTTPS as HTTPS Download
    participant FS as File System

    Build->>Script: Execute build-geo script
    Script->>Env: Check SKIP_BUILD_GEO
    alt SKIP_BUILD_GEO is set
        Script->>Build: Exit 0 (skip geo setup)
    else SKIP_BUILD_GEO not set
        Script->>Env: Check VERCEL && !BUILD_GEO
        alt Vercel without BUILD_GEO
            Script->>Build: Exit 0 (skip geo setup)
        else Continue with geo setup
            Script->>Env: Check GEO_DATABASE_URL
            alt Custom URL provided
                Script->>Script: Use GEO_DATABASE_URL
            else No custom URL
                Script->>Env: Check MAXMIND_LICENSE_KEY
                alt License key exists
                    Script->>Script: Use MaxMind URL
                else No license key
                    Script->>Script: Use GitHub fallback URL
                end
            end
            Script->>FS: Check/Create geo directory
            alt URL ends with .mmdb
                Script->>HTTPS: Download direct .mmdb file
                HTTPS->>FS: Save to geo directory
            else URL is tar.gz
                Script->>HTTPS: Download compressed file
                HTTPS->>Script: Stream tar.gz
                Script->>Script: Decompress and extract .mmdb
                Script->>FS: Save to geo directory
            end
            Script->>Build: Exit 0 (success) or Exit 1 (error)
        end
    end
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 file reviewed, no comments

Edit Code Review Agent Settings | Greptile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant