Fix some small bugs
This commit is contained in:
parent
4204081563
commit
e5055a1237
|
@ -14,6 +14,9 @@ help: ## Print this help.
|
|||
deploy:
|
||||
/home/hmn/hmn/server/deploy.sh $1
|
||||
|
||||
build:
|
||||
sudo -u hmn --preserve-env=PATH bash -c "cd ~/hmn && go build -o /home/hmn/bin/hmn src/main.go"
|
||||
|
||||
edit-config:
|
||||
vim /home/hmn/hmn/src/config/config.go
|
||||
@echo 'Now that you have edited the config, you probably want to re-deploy the site:'
|
||||
|
@ -21,7 +24,7 @@ edit-config:
|
|||
@echo ' make deploy'
|
||||
@echo ''
|
||||
|
||||
logs-hmn: ## View logs for the website
|
||||
logs: ## View logs for the website
|
||||
journalctl -u hmn.service -f
|
||||
|
||||
logs-caddy: ## View logs for Caddy
|
||||
|
|
|
@ -135,7 +135,9 @@ SCRIPT
|
|||
fi
|
||||
|
||||
# Set up SSH
|
||||
if [ $checkpoint -lt 81]
|
||||
if [ $checkpoint -lt 81 ]; then
|
||||
set +x
|
||||
|
||||
do_as hmn <<'SCRIPT'
|
||||
ssh-keygen -t ed25519 -C "beta-server" -N "" -f ~/.ssh/gitlab
|
||||
git config --global core.sshCommand "ssh -i ~/.ssh/gitlab"
|
||||
|
@ -253,9 +255,22 @@ ${BLUE_BOLD}Caddy${RESET}: /home/caddy/Caddyfile
|
|||
use when deploying. For example, a deployment of the beta site should use
|
||||
the 'beta' branch.
|
||||
|
||||
${BLUE_BOLD}Monit${RESET}: ~/.monitrc
|
||||
${BLUE_BOLD}Website${RESET}: /home/hmn/hmn/src/config/config.go
|
||||
|
||||
Add the password for the email server.
|
||||
First make sure you have Go on your path:
|
||||
|
||||
source ~/.bashrc
|
||||
|
||||
Then edit the config file using a special make task:
|
||||
|
||||
make edit-config
|
||||
|
||||
Fill out everything, then rebuild the site:
|
||||
|
||||
make build
|
||||
|
||||
You don't need to deploy the site yet; wait until you've
|
||||
configured everything.
|
||||
|
||||
${BLUE_BOLD}Deploy Secret${RESET}: /home/hmn/hmn/server/deploy.conf
|
||||
|
||||
|
@ -267,16 +282,6 @@ ${BLUE_BOLD}Deploy Secret${RESET}: /home/hmn/hmn/server/deploy.conf
|
|||
Then, edit the above file and fill in the secret value from the
|
||||
GitLab webhook.
|
||||
|
||||
${BLUE_BOLD}Website${RESET}: /home/hmn/hmn/src/config/config.go
|
||||
|
||||
Fill out everything :)
|
||||
|
||||
Then rebuild the site:
|
||||
|
||||
su hmn
|
||||
cd ~/hmn
|
||||
go build -o /home/hmn/bin/hmn src/main.go
|
||||
|
||||
${BLUE_BOLD}Cinera${RESET}: /home/hmn/hmn/cinera/cinera.conf
|
||||
|
||||
Add the correct domain.
|
||||
|
@ -302,4 +307,6 @@ Then deploy the site:
|
|||
|
||||
make deploy
|
||||
|
||||
Run 'make' on its own to see all the other tasks available to you!
|
||||
|
||||
HELP
|
||||
|
|
|
@ -39,8 +39,8 @@ var Config = HMNConfig{
|
|||
AssetsSpacesRegion: "",
|
||||
AssetsSpacesEndpoint: "",
|
||||
AssetsSpacesBucket: "",
|
||||
AssetsPathPrefix: "",
|
||||
AssetsPublicUrlRoot: "",
|
||||
AssetsPathPrefix: "", // Empty is fine for production, but may be necessary for dev
|
||||
AssetsPublicUrlRoot: "", // e.g. "https://bucket-name.region.cdn.digitaloceanspaces.com/". Note the trailing slash...
|
||||
},
|
||||
EpisodeGuide: EpisodeGuide{
|
||||
CineraOutputPath: "./annotations/",
|
||||
|
|
|
@ -14,6 +14,7 @@ import (
|
|||
"regexp"
|
||||
"strings"
|
||||
|
||||
"git.handmade.network/hmn/hmn/src/hmnurl"
|
||||
"git.handmade.network/hmn/hmn/src/logging"
|
||||
"git.handmade.network/hmn/hmn/src/models"
|
||||
"git.handmade.network/hmn/hmn/src/oops"
|
||||
|
@ -252,7 +253,11 @@ func (c *RequestContext) Redirect(dest string, code int) ResponseData {
|
|||
}
|
||||
|
||||
// Escape stuff
|
||||
destUrl, _ := url.Parse(dest)
|
||||
destUrl, err := url.Parse(dest)
|
||||
if err != nil {
|
||||
c.Logger.Warn().Err(err).Str("dest", dest).Msg("Failed to parse redirect URI")
|
||||
return c.Redirect(hmnurl.BuildHomepage(), http.StatusSeeOther)
|
||||
}
|
||||
dest = destUrl.String()
|
||||
|
||||
res.Header().Set("Location", dest)
|
||||
|
|
Loading…
Reference in New Issue