Skip to content

Make default StaticRootPath compile time settable#12371

Merged
zeripath merged 9 commits into
go-gitea:masterfrom
6543-forks:own_var_for_AppStaticRootPath
Aug 8, 2020
Merged

Make default StaticRootPath compile time settable#12371
zeripath merged 9 commits into
go-gitea:masterfrom
6543-forks:own_var_for_AppStaticRootPath

Conversation

@6543
Copy link
Copy Markdown
Member

@6543 6543 commented Jul 29, 2020

be able to compile default location of StaticRootPath independent from AppWorkPath

so you can compile with

	LDFLAGS="-X \"code.gitea.io/gitea/modules/setting.StaticRootPath=/usr/share/webapps/gitea/\""
	LDFLAGS="$LDFLAGS -X \"code.gitea.io/gitea/modules/setting.AppWorkPath=/var/lib/gitea/\""
	export LDFLAGS

Copy link
Copy Markdown
Contributor

@zeripath zeripath left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't quite understand the need for the new AppStaticRootPath variable - it's not as if all the App prefixed variables are compile time settable.

Comment thread modules/setting/setting.go Outdated
Comment thread modules/setting/setting.go Outdated
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jul 31, 2020
@zeripath
Copy link
Copy Markdown
Contributor

Need to also update installation/from-source.en-us.md:

diff --git a/docs/content/doc/installation/from-source.en-us.md b/docs/content/doc/installation/from-source.en-us.md
index cf3f599c5..9c7016577 100644
--- a/docs/content/doc/installation/from-source.en-us.md
+++ b/docs/content/doc/installation/from-source.en-us.md
@@ -143,7 +143,7 @@ Gitea will search for a number of things from the `CustomPath`. By default this
 the `custom/` directory in the current working directory when running Gitea. It will also
 look for its configuration file `CustomConf` in `$CustomPath/conf/app.ini`, and will use the
 current working directory as the relative base path `AppWorkPath` for a number configurable
-values.
+values. Finally the static files will be served from `StaticRootPath` which defaults to the `AppWorkPath`.
 
 These values, although useful when developing, may conflict with downstream users preferences.
 
@@ -154,6 +154,7 @@ using the `LDFLAGS` environment variable for `make`. The appropriate settings ar
 * To set the `CustomPath` use `LDFLAGS="-X \"code.gitea.io/gitea/modules/setting.CustomPath=custom-path\""`
 * For `CustomConf` you should use `-X \"code.gitea.io/gitea/modules/setting.CustomConf=conf.ini\"`
 * For `AppWorkPath` you should use `-X \"code.gitea.io/gitea/modules/setting.AppWorkPath=working-path\"`
+* For `StaticRootPath` you should use `-X \"code.gitea.io/gitea/modules/setting.StaticRootPath=static-root-path\"`
 
 Add as many of the strings with their preceding `-X` to the `LDFLAGS` variable and run `make build`
 with the appropriate `TAGS` as above.

Signed-off-by: Andrew Thornton <art27@cantab.net>
@zeripath zeripath changed the title Settings: introduce AppStaticRootPath var Make default StaticRootPath compile time settable Aug 1, 2020
@zeripath
Copy link
Copy Markdown
Contributor

zeripath commented Aug 1, 2020

@6543 I hope you don't mind that I've just made those above changes.

Comment thread modules/setting/setting.go Outdated
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Aug 1, 2020
@zeripath zeripath added the topic/build PR changes how Gitea is built, i.e. regarding Docker or the Makefile label Aug 1, 2020
@zeripath zeripath added this to the 1.13.0 milestone Aug 1, 2020
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Aug 8, 2020
@zeripath
Copy link
Copy Markdown
Contributor

zeripath commented Aug 8, 2020

make lg-tm work

@zeripath zeripath merged commit 78d17b4 into go-gitea:master Aug 8, 2020
@6543 6543 deleted the own_var_for_AppStaticRootPath branch August 8, 2020 20:33
@6543
Copy link
Copy Markdown
Member Author

6543 commented Aug 8, 2020

Thx

6543 added a commit to 6543-forks/gitea that referenced this pull request Sep 1, 2020
Make it possible to compile the default location of StaticRootPath independent from AppWorkPath

Co-authored-by: Andrew Thornton <art27@cantab.net>
@techknowlogick techknowlogick added the backport/done All backports for this PR have been created label Sep 2, 2020
techknowlogick added a commit that referenced this pull request Sep 2, 2020
Make it possible to compile the default location of StaticRootPath independent from AppWorkPath

Co-authored-by: Andrew Thornton <art27@cantab.net>

Co-authored-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

backport/done All backports for this PR have been created lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. topic/build PR changes how Gitea is built, i.e. regarding Docker or the Makefile

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants