Use tmux set-environment

This allows to set environment for whole session.
Way better than sending explicit export commands in different shells.

This also allows each new pane to inherit the same environment.
This commit is contained in:
Daniel Siepmann 2023-02-18 11:21:24 +01:00
parent ca56b18b8f
commit c9ce9b957b
Signed by: Daniel Siepmann
GPG key ID: 33D6629915560EF4

View file

@ -37,12 +37,28 @@ writeShellApplication {
editorPath="$projectRoot/htdocs"
fi
# Open Editor
# Start new session with editor as name for first window
tmux new-session -s "$session" -n editor -d
tmux send-keys "export TYPO3_BASE=$url TYPO3_COMPOSER_AUTOLOAD=1 SOLR_HOST=localhost SOLR_PORT=8983 SOLR_SCHEME=http SOLR_CORE=core_de" C-m
tmux send-keys "export typo3DatabaseName=testing typo3DatabaseHost=localhost typo3DatabaseUsername=testing typo3DatabasePassword=testing" C-m
# Set environment
tmux set-environment -t "$session" TYPO3_BASE "$url"
tmux set-environment -t "$session" TYPO3_COMPOSER_AUTOLOAD 1
tmux set-environment -t "$session" typo3DatabaseName testing
tmux set-environment -t "$session" typo3DatabaseHost localhost
tmux set-environment -t "$session" typo3DatabaseUsername testing
tmux set-environment -t "$session" typo3DatabasePassword testing
tmux set-environment -t "$session" TYPO3_DATABASE "$databaseName"
# TODO: Find a better way to determine instance path for acceptance tests
tmux send-keys "export INSTANCE_PATH=\"$editorPath/typo3temp/var/tests/acceptance\"" C-m
tmux set-environment -t "$session" INSTANCE_PATH "$editorPath/typo3temp/var/tests/acceptance"
tmux set-environment -t "$session" SOLR_HOST localhost
tmux set-environment -t "$session" SOLR_PORT 8983
tmux set-environment -t "$session" SOLR_SCHEME http
tmux set-environment -t "$session" SOLR_CORE core_de
# Open Editor
tmux send-keys " renice -n 5 \$\$" C-m
tmux send-keys " cd $editorPath" C-m
tmux send-keys C-l
@ -53,15 +69,7 @@ writeShellApplication {
tmux new-window -n project -t "$session"
tmux send-keys -t "$session:$windowId" "cd $editorPath" C-m
tmux send-keys " renice -n 5 \$\$" C-m
tmux send-keys "export TYPO3_BASE=$url TYPO3_COMPOSER_AUTOLOAD=1 SOLR_HOST=localhost SOLR_PORT=8983 SOLR_SCHEME=http SOLR_CORE=core_de" C-m
tmux send-keys "export typo3DatabaseName=testing typo3DatabaseHost=localhost typo3DatabaseUsername=testing typo3DatabasePassword=testing" C-m
tmux send-keys C-l
if [ "$databaseName" != "" ]; then
tmux send-keys "export TYPO3_DATABASE=$databaseName" C-m
tmux send-keys C-l
else
tmux send-keys "export TYPO3_DATABASE="
fi
(( "windowId+=1" ))
tmux select-pane -t 0