Skip to content

Commit

Permalink
use connectors cli configuration; revert changes
Browse files Browse the repository at this point in the history
  • Loading branch information
markjhoy committed Jan 10, 2024
1 parent 225592b commit 2ef205d
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 5 deletions.
3 changes: 1 addition & 2 deletions connectors/connectors_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,14 @@
from connectors.cli.index import Index
from connectors.cli.job import Job
from connectors.config import _default_config
from connectors.config import load_config as configuration_loader
from connectors.es.settings import Settings

__all__ = ["main"]


def load_config(ctx, config):
if config:
return configuration_loader(config.name)
return yaml.safe_load(config)
elif os.path.isfile(CONFIG_FILE_PATH):
with open(CONFIG_FILE_PATH, "r") as f:
return yaml.safe_load(f.read())
Expand Down
4 changes: 4 additions & 0 deletions scripts/stack/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ ELASTICSEARCH_VERSION=8.11.2 KIBANA_VERSION=8.11.2 CONNECTORS_VERSION=8.11.2.0 .

Once the stack is running, you can monitor the logs from the Connectors instance by running:
```bash
./scripts/stack/view-connectors-logs.sh
```
or:
```bash
docker-compose -f ./scripts/stack/docker/docker-compose.yml logs -f elastic-connectors
```

Expand Down
16 changes: 14 additions & 2 deletions scripts/stack/configure-connectors.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,18 @@ pushd $PROJECT_ROOT
if [[ "${CONFIG_FILE:-}" == "" ]]; then
CONFIG_FILE="${PROJECT_ROOT}/scripts/stack/connectors-config/config.yml"
fi
CLI_CONFIG="${PROJECT_ROOT}/scripts/stack/connectors-config/cli_config.yml"

# ensure our Connectors CLI config exists and has the correct information
if [ ! -f "$CLI_CONFIG" ]; then
cliConfigText='
elasticsearch:
host: http://localhost:9200
password: '"${ELASTIC_PASSWORD}"'
username: elastic
'
echo "${cliConfigText}" > "$CLI_CONFIG"
fi

CONNECTORS_EXE="${PROJECT_ROOT}/bin/connectors"
if [ ! -f "$CONNECTORS_EXE" ]; then
Expand All @@ -39,7 +51,7 @@ pushd $PROJECT_ROOT
while [ $keep_configuring == true ]; do
echo
echo "Currently configured connectors:"
$CONNECTORS_EXE --config "$CONFIG_FILE" connector list
$CONNECTORS_EXE --config "$CLI_CONFIG" connector list
echo
while true; do
read -p "Do you want to set up a new connector? (y/N) " yn
Expand All @@ -51,7 +63,7 @@ pushd $PROJECT_ROOT
done

if [ $keep_configuring == true ]; then
$CONNECTORS_EXE --config "${CONFIG_FILE}" connector create --connector-service-config "$CONFIG_FILE" --update-config
$CONNECTORS_EXE --config "${CLI_CONFIG}" connector create --connector-service-config "$CONFIG_FILE" --update-config
fi
done
popd
1 change: 1 addition & 0 deletions scripts/stack/copy-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ cp "$CONFIG_PATH" "$script_config"
echo "copied config from $CONFIG_PATH to $config_dir"

if [[ "$is_example_config" == true ]]; then
export CONFIG_FILE="$script_config"
sed_cmd="sed -i"
if [[ "$MACHINE_OS" == "MacOS" || "$MACHINE_OS" == "FreeBSD" ]]; then
sed_cmd="sed -i -e"
Expand Down
2 changes: 1 addition & 1 deletion scripts/stack/run-stack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ if [[ "${bypass_config:-}" == false ]]; then
done
if [ $run_configurator == "yes" ]; then
source ./copy-config.sh
source ./configure-connectors.sh $SECURE_STATE_DIR
source ./configure-connectors.sh
fi
fi

Expand Down

0 comments on commit 2ef205d

Please sign in to comment.