Skip to content
This repository has been archived by the owner on Aug 16, 2022. It is now read-only.

Commit

Permalink
Merge branch 'main' into plugin-metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
mimoham24 committed Jun 15, 2021
2 parents 0d01cce + ef75dd0 commit f6ca798
Show file tree
Hide file tree
Showing 46 changed files with 16,131 additions and 67 deletions.
69 changes: 69 additions & 0 deletions .github/workflows/godoc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: godoc
on:
workflow_run:
workflows:
- main
types:
- completed
env:
MOD: github.com/reearth/reearth-backend
REPO: github.com/reearth/reearth-backend
REPO_NAME: reearth-backend
ADDR: 'localhost:8080'
jobs:
godoc:
name: godoc
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
env:
DIR: ${{ github.event.workflow_run.head_branch }}
steps:
- name: set up
uses: actions/setup-go@v2
with:
go-version: 1.16
id: go
- name: checkout
uses: actions/checkout@v2
- name: cache
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- run: go mod download
- name: install godoc
run: go install golang.org/x/tools/cmd/godoc@latest
- name: generate docs
continue-on-error: true
run: |
godoc -http="$ADDR" &
sleep 10
wget -r -np -N -E -p -k "http://${ADDR}/pkg/${MOD}/"
- name: replace urls
run: |
[ `find . -name "*.html" -type f | wc -l` -eq 0 ] && exit 1
find ./${ADDR}/ -name "*.html" -print0 | xargs -0 sed -i \
-e "s@http://${ADDR}/src/${MOD}@https://${REPO}/blob/main@" \
-e "s@\"http://${ADDR}/pkg/\"@\"/${REPO_NAME}/${DIR}/pkg/${REPO}/\"@" \
-e 's@<form @<form style="display:none" @' \
-e "s@http://${ADDR}@/${REPO_NAME}/${DIR}@"
- name: deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./${{ env.ADDR }}
destination_dir: ${{ env.DIR }}
slack-notification:
if: always()
name: Slack Notification
needs: godoc
runs-on: ubuntu-latest
steps:
- name: Slack Notification
uses: Gamesight/slack-workflow-status@master
if: always()
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
slack_webhook_url: ${{ secrets.SLACK_WEBHOOK_URL }}
41 changes: 0 additions & 41 deletions cmd/godoc/main.go

This file was deleted.

1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
module github.com/reearth/reearth-backend

// +heroku install golang.org/x/tools/cmd/godoc
require (
cloud.google.com/go v0.80.0
cloud.google.com/go/storage v1.14.0
Expand Down
3 changes: 3 additions & 0 deletions internal/adapter/graphql/controller_project.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ func (c *ProjectController) Update(ctx context.Context, ginput *UpdateProjectInp
Alias: ginput.Alias,
ImageURL: ginput.ImageURL,
Archived: ginput.Archived,
IsBasicAuthActive: ginput.IsBasicAuthActive,
BasicAuthUsername: ginput.BasicAuthUsername,
BasicAuthPassword: ginput.BasicAuthPassword,
PublicTitle: ginput.PublicTitle,
PublicDescription: ginput.PublicDescription,
PublicImage: fromFile(ginput.PublicImage),
Expand Down
3 changes: 3 additions & 0 deletions internal/adapter/graphql/convert_project.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ func toProject(p *project.Project) *Project {
ID: p.ID().ID(),
CreatedAt: p.CreatedAt(),
IsArchived: p.IsArchived(),
IsBasicAuthActive: p.IsBasicAuthActive(),
BasicAuthUsername: p.BasicAuthUsername(),
BasicAuthPassword: p.BasicAuthPassword(),
Alias: p.Alias(),
Name: p.Name(),
Description: p.Description(),
Expand Down
1 change: 1 addition & 0 deletions internal/adapter/graphql/convert_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ func toUser(user *user.User) *User {
Name: user.Name(),
Email: user.Email(),
Lang: user.Lang(),
Theme: Theme(user.Theme()),
MyTeamID: user.Team().ID(),
Auths: authsgql,
}
Expand Down
6 changes: 6 additions & 0 deletions internal/adapter/graphql/models_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 7 additions & 4 deletions internal/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,13 @@ func apiPublished(cfg *ServerConfig) echo.HandlerFunc {
}

return c.JSON(http.StatusOK, map[string]interface{}{
"title": title,
"description": description,
"image": prj.PublicImage(),
"noindex": prj.PublicNoIndex(),
"title": title,
"description": description,
"image": prj.PublicImage(),
"noindex": prj.PublicNoIndex(),
"isBasicAuthActive": prj.IsBasicAuthActive(),
"basicAuthUsername": prj.BasicAuthUsername(),
"basicAuthPassword": prj.BasicAuthPassword(),
})
}
}
Expand Down
11 changes: 5 additions & 6 deletions internal/app/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,11 @@ type GCSConfig struct {
}

func ReadConfig(debug bool) (*Config, error) {
if debug {
// .env.local file is only available in debug environment
if err := godotenv.Load(".env.local"); err != nil && !os.IsNotExist(err) {
return nil, err
}
log.Infof("config: .env.local loaded")
// load .env
if err := godotenv.Load(".env"); err != nil && !os.IsNotExist(err) {
return nil, err
} else if err == nil {
log.Infof("config: .env loaded")
}

var c Config
Expand Down
Loading

0 comments on commit f6ca798

Please sign in to comment.