Skip to content
Draft
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
2 changes: 2 additions & 0 deletions build/cdc_services/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,8 @@ COPY --from=download /tmp/datcom-nl-models /tmp/datcom-nl-models
# Copy executable script.
COPY build/cdc_services/run.sh .

COPY build/cdc_services/mixer_custom.yaml .

# Make script executable.
RUN chmod +x run.sh

Expand Down
2 changes: 2 additions & 0 deletions build/cdc_services/mixer_custom.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
flags:
EnableEmbeddingsResolver: true
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

It's a best practice for text files to end with a newline character. Some tools may not process the last line correctly if it's missing. Please add a newline at the end of this file.

  EnableEmbeddingsResolver: true

9 changes: 8 additions & 1 deletion build/cdc_services/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ fi

nginx -c /workspace/nginx.conf

MIXER_ARGS=""
if [[ $ENABLE_MODEL == "true" ]]; then
MIXER_ARGS="--embeddings_server_url=http://localhost:6060"
fi
Comment on lines +61 to +64
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Using a string to build up command-line arguments is fragile and can lead to issues with word splitting, especially if arguments contain spaces. A more robust approach is to use a bash array. This will make the script more maintainable and less error-prone.

Suggested change
MIXER_ARGS=""
if [[ $ENABLE_MODEL == "true" ]]; then
MIXER_ARGS="--embeddings_server_url=http://localhost:6060"
fi
MIXER_ARGS=()
if [[ $ENABLE_MODEL == "true" ]]; then
MIXER_ARGS+=(--embeddings_server_url=http://localhost:6060)
fi


/workspace/bin/mixer \
--use_bigquery=false \
--use_base_bigtable=false \
Expand All @@ -67,7 +72,9 @@ nginx -c /workspace/nginx.conf
--use_sqlite=$USE_SQLITE \
--use_cloudsql=$USE_CLOUDSQL \
--cloudsql_instance=$CLOUDSQL_INSTANCE \
--remote_mixer_domain=$DC_API_ROOT &
--feature_flags_path=mixer_custom.yaml \
--remote_mixer_domain=$DC_API_ROOT \
$MIXER_ARGS &
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

In conjunction with the previous suggestion to use an array for MIXER_ARGS, you should expand the array using "${MIXER_ARGS[@]}". This ensures each argument is passed correctly, preventing issues with word splitting and globbing.

Suggested change
$MIXER_ARGS &
"${MIXER_ARGS[@]}" &


envoy -l warning --config-path /workspace/esp/envoy-config.yaml &

Expand Down
Loading