-
Notifications
You must be signed in to change notification settings - Fork 2.8k
docker: configure config.toml using environment variable #751
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
navilg
wants to merge
5
commits into
ItzCrazyKns:master
Choose a base branch
from
navilg:feat/replace-config-toml
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
64136b8
docker: configure config.toml using environment variable
navilg 237f1bb
fix: incorrect environment variable
navilg 4ef3446
Merge branch 'master' of github.com:navilg/Perplexica into feat/repla…
navilg b847e04
fix: compose file mismatch
navilg 86c7201
Update docker-compose.yaml
navilg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| CONFIG_TOML_FILE=/home/perplexica/config.toml | ||
|
|
||
| TMP_FILE=${CONFIG_TOML_FILE}.tmp | ||
| touch $TMP_FILE | ||
|
|
||
| while IFS= read -r line; do | ||
| # Check if line is a section header (e.g., "[GENERAL]") | ||
| if [[ "$line" =~ ^\[([^]]+)\] ]]; then | ||
| current_section="${BASH_REMATCH[1]}" | ||
| echo "$line" >> "$TMP_FILE" | ||
| continue | ||
| fi | ||
|
|
||
| # Skip empty lines and comments | ||
| if [[ -z "$line" || "$line" =~ ^[[:space:]]*\# ]]; then | ||
| echo "$line" >> "$TMP_FILE" | ||
| continue | ||
| fi | ||
|
|
||
| # Extract key and value (handling quoted values) | ||
| key=$(echo "$line" | cut -d '=' -f 1 | xargs) | ||
| value=$(echo "$line" | cut -d '=' -f 2- | xargs) | ||
|
|
||
|
|
||
| # Construct the environment variable name in form of SECTION_KEY (e.g., GENERAL_SIMILARITY_MEASURE, MODELS_GEMINI_API_KEY) | ||
| current_section=$(echo "$current_section" | sed 's/\./_/') | ||
| env_var_name="${current_section}_${key}" | ||
|
|
||
| # Check if the environment variable exists | ||
| env_var_value=$(echo "${!env_var_name}") | ||
| if [ -n "$env_var_value" ]; then | ||
| new_value="$env_var_value" | ||
| echo "$key = $new_value" >> "$TMP_FILE" | ||
| else | ||
| # Keep original line if no env var exists | ||
| echo "$line" >> "$TMP_FILE" | ||
| fi | ||
|
|
||
| done < "$CONFIG_TOML_FILE" | ||
|
|
||
| # Replace the original file | ||
| mv "$TMP_FILE" "$CONFIG_TOML_FILE" | ||
|
|
||
| echo "Config file updated successfully." | ||
|
|
||
| # Start server | ||
| node server.js |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,14 +16,26 @@ services: | |
| dockerfile: app.dockerfile | ||
| environment: | ||
| - SEARXNG_API_URL=http://searxng:8080 | ||
| - GENERAL_SIMILARITY_MEASURE="cosine" # "cosine" or "dot" | ||
navilg marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - GENERAL_KEEP_ALIVE="5m" # How long to keep Ollama models loaded into memory. (Instead of using -1 use "-1m") | ||
| - MODELS_OPENAI_API_KEY="" | ||
| - MODELS_GROQ_API_KEY="" | ||
| - MODELS_ANTHROPIC_API_KEY="" | ||
| - MODELS_GEMINI_API_KEY="" | ||
| - MODELS_CUSTOM_OPENAI_API_KEY="" | ||
| - MODELS_CUSTOM_OPENAI_API_URL="" | ||
| - MODELS_CUSTOM_OPENAI_MODEL_NAME="" | ||
| - MODELS_OLLAMA_API_KEY="" # Ollama API URL - http://host.docker.internal:11434 | ||
|
||
| - MODELS_DEEPSEEK_API_KEY="" | ||
| - MODELS_LM_STUDIO_API_KEY="" # LM Studio API URL - http://host.docker.internal:1234 | ||
|
||
| - API_ENDPOINTS_SEARXNG="" # SearxNG API URL - http://localhost:32768 | ||
| ports: | ||
| - 3000:3000 | ||
| networks: | ||
| - perplexica-network | ||
| volumes: | ||
| - backend-dbstore:/home/perplexica/data | ||
| - uploads:/home/perplexica/uploads | ||
| - ./config.toml:/home/perplexica/config.toml | ||
| restart: unless-stopped | ||
|
|
||
| networks: | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.