-
Notifications
You must be signed in to change notification settings - Fork 3
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
Route #13
Merged
Merged
Route #13
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
0378422
initial commit for the route changes
hizclick 2170e5c
overwrite publicPath with an entrypoint script
peterstadler 12ccff0
Merge branch 'dev' into route
peterstadler 680f8bd
re assign the width and the height of facsimile
hizclick 6b06470
add sub path option for deployment
hizclick 5b83fff
remove duplicated comments from 40-create-ghcred.sh
hizclick 2e41245
add route to Github
hizclick 745fed4
remove last line from 40-create-ghcred.sh
hizclick 21950b1
Update 40-create-ghcred.sh
hizclick 4e0f1dc
Update 40-create-ghcred.sh
hizclick 6bcda40
Revert irrelevant changes from src/store/index.js
hizclick 6102b72
Reconfiguring ngnix.conf
hizclick 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 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 |
---|---|---|
@@ -1,8 +1,24 @@ | ||
#/bin/sh | ||
# create nginx config from evironment | ||
# *prevent envsubst from killing nginx vars with 'tr' and '@'* | ||
#!/bin/sh | ||
|
||
# Set default value for VUE_APP_PUBLIC_PATH if not provided | ||
# Remove leading and trailing whitespace and slashes from VUE_APP_PUBLIC_PATH | ||
VUE_APP_PUBLIC_PATH=$(echo $VUE_APP_PUBLIC_PATH | sed 's/^\s*\///;s/\/\s*$//') | ||
|
||
# Add leading slash only if string is not empty | ||
if [ "$VUE_APP_PUBLIC_PATH" != "/" ] && [ "$VUE_APP_PUBLIC_PATH" != "" ]; then | ||
VUE_APP_PUBLIC_PATH="/$VUE_APP_PUBLIC_PATH" | ||
fi | ||
|
||
# Link the Vue.js app to the public path | ||
ln -s /usr/share/nginx/html /usr/share/nginx/html/"$VUE_APP_PUBLIC_PATH" | ||
sed -i "s+/myAppPlaceholder+$VUE_APP_PUBLIC_PATH+g" /usr/share/nginx/html/index.html | ||
sed -i "s+/myAppPlaceholder+$VUE_APP_PUBLIC_PATH+g" /usr/share/nginx/html/js/app.*.js | ||
|
||
# Create NGINX configuration from environment variables | ||
# The @ character is used to prevent envsubst from interpreting NGINX variables | ||
cat <<EOT | envsubst | tr '@' '$' >/GH_OAUTH_CLIENT.conf | ||
set @CLIENT_ID $CLIENT_ID; | ||
set @CLIENT_SECRET $CLIENT_SECRET; | ||
set @CALL_BACK $CALL_BACK | ||
EOT | ||
# Handle CLIENT_ID, CLIENT_SECRET, and CALL_BACK - they can be empty | ||
set @CLIENT_ID "${CLIENT_ID:-}"; | ||
set @CLIENT_SECRET "${CLIENT_SECRET:-}"; | ||
set @CALL_BACK "${CALL_BACK:-}"; | ||
EOT |
This file contains 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 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 |
---|---|---|
@@ -1,34 +1,44 @@ | ||
server { | ||
listen 80; | ||
|
||
# declare token is "" (empty str) for original request without args,because $is_args concat any var will be `?` | ||
set $token ""; | ||
# if the request has args update token to "&" | ||
# request without args doesn't make sense in this case | ||
if ($is_args) { | ||
set $token "&"; | ||
# Load environment variables from a file created on container start (it might be empty) | ||
include "/GH_OAUTH_CLIENT.conf"; # This file may be empty or missing values | ||
|
||
# Default to empty strings if CLIENT_ID or CLIENT_SECRET are not set | ||
set $client_id ""; | ||
set $client_secret ""; | ||
|
||
# Check if environment variables were set, otherwise default to empty | ||
if ($CLIENT_ID) { | ||
set $client_id "client_id=${CLIENT_ID}"; | ||
} | ||
# file created on container start from env vars (40-create-ghcred.sh) | ||
include "/GH_OAUTH_CLIENT.conf"; | ||
# reverse proxy to github access_token | ||
# set rule to /auth explicitly | ||
if ($CLIENT_SECRET) { | ||
set $client_secret "client_secret=${CLIENT_SECRET}"; | ||
} | ||
|
||
# Reverse proxy to GitHub OAuth access token | ||
location = /auth { | ||
set $args "${args}${token}client_id=${CLIENT_ID}&client_secret=${CLIENT_SECRET}"; | ||
# Handle query arguments | ||
set $token ""; | ||
if ($is_args) { | ||
set $token "&"; | ||
} | ||
|
||
# Concatenate the query arguments with client_id and client_secret, if set | ||
set $args "${args}${token}${client_id}&${client_secret}"; | ||
|
||
# Proxy request to GitHub OAuth access token endpoint | ||
proxy_pass https://github.com/login/oauth/access_token$is_args$args; | ||
proxy_set_header accept "application/json"; | ||
proxy_set_header Accept "application/json"; | ||
} | ||
|
||
# Serve Vue.js application from VUE_APP_PUBLIC_PATH | ||
|
||
# default rule to access app | ||
location / { | ||
root /usr/share/nginx/html; | ||
index index.html; | ||
try_files $uri $uri/ /index.html; | ||
} | ||
# Redirect requests without trailing slash to include it | ||
location ~ ^(.*)/$ { | ||
return 301 $1; | ||
# Serve Vue.js application and handle optional URL rewrites | ||
location / { | ||
root /usr/share/nginx/html; | ||
index index.html; | ||
try_files $uri $uri/ /index.html; | ||
|
||
# Optional: Redirect requests that lack a trailing slash to add one | ||
rewrite ^([^.]*[^/])$ $1/ permanent; | ||
} | ||
} | ||
s |
This file contains 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 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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
/* global __webpack_public_path__:writable */ | ||
/* exported __webpack_public_path__ */ | ||
__webpack_public_path__ = window.PUBLIC_PATH,process.env.PUBLIC_PATH; | ||
//__webpack_public_path__ = '/myapp'; |
This file contains 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 |
---|---|---|
@@ -1,6 +1,4 @@ | ||
|
||
module.exports = { | ||
publicPath: process.env.NODE_ENV === 'production' | ||
? process.env.VUE_APP_PUBLIC_PATH | ||
: '/' | ||
} | ||
publicPath: "/myAppPlaceholder" | ||
} |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we need the GitHub authentication?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2e41245
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2e41245
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing changed here in 2e41245?!