Skip to content

Commit

Permalink
chore(devspace): Add DevSpace start script (GH-1235)
Browse files Browse the repository at this point in the history
  • Loading branch information
433eros authored Dec 22, 2023
1 parent 0aa6e41 commit 8213098
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 2 deletions.
53 changes: 53 additions & 0 deletions devspace_start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/usr/bin/env bash

set +e # Continue on errors

if [ -f "Gemfile" ]; then
echo "Installing Ruby Dependencies"
bundle install -j4 --retry 3
fi

export NODE_ENV=development
if [ -f "yarn.lock" ]; then
echo "Installing Yarn Dependencies"
yarn
else
if [ -f "package.json" ]; then
echo "Installing NPM Dependencies"
npm install
fi
fi

COLOR_BLUE="\033[0;94m"
COLOR_GREEN="\033[0;92m"
COLOR_RESET="\033[0m"

# Print useful output for user
echo -e "${COLOR_BLUE}
%########%
%###########% ____ _____
%#########% | _ \ ___ __ __ / ___/ ____ ____ ____ ___
%#########% | | | | / _ \\\\\ \ / / \___ \ | _ \ / _ | / __// _ \\
%#############% | |_| |( __/ \ V / ____) )| |_) )( (_| |( (__( __/
%#############% |____/ \___| \_/ \____/ | __/ \__,_| \___\\\\\___|
%###############% |_|
%###########%${COLOR_RESET}
Welcome to your development container!
This is how you can work with it:
- Files will be synchronized between your local machine and this container
- Some ports will be forwarded, so you can access this container via localhost
- Run \`${COLOR_GREEN}devspace run start${COLOR_RESET}\` to start the application
"

# Set terminal prompt
export PS1="\[${COLOR_BLUE}\]devspace\[${COLOR_RESET}\] ./\W \[${COLOR_BLUE}\]\\$\[${COLOR_RESET}\] "
if [ -z "$BASH" ]; then export PS1="$ "; fi

# Include project's bin/ folder in PATH
export PATH="./bin:$PATH"

# Open shell
bash --norc
2 changes: 1 addition & 1 deletion rails/config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ class Application < Rails::Application

# Specify cookies SameSite protection level: either :none, :lax, or :strict.
# When running tests, we want to use lax protection (breaks cucumber tests otherwise)
same_site_protection = (Rails.env.cucumber? || Rails.env.test? || Rails.env.feature_test?) ? :lax : :none
same_site_protection = (Rails.env.development? || Rails.env.cucumber? || Rails.env.test? || Rails.env.feature_test?) ? :lax : :none
config.action_dispatch.cookies_same_site_protection = same_site_protection

# Allow requests from any domain (skips DNS rebinding attack guards)
Expand Down
2 changes: 1 addition & 1 deletion rails/config/initializers/session_store.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
# (create the session table with "rails generate session_migration")

# For testing environments, we don't use SSL and can't set cookie to secure.
secure = !(Rails.env.cucumber? || Rails.env.test? || Rails.env.feature_test?)
secure = !(Rails.env.development? || Rails.env.cucumber? || Rails.env.test? || Rails.env.feature_test?)
RailsPortal::Application.config.session_store :active_record_store, :key => '_rails_portal_session', secure: secure

0 comments on commit 8213098

Please sign in to comment.