-
-
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
next round of refactoring #35
Merged
Changes from 1 commit
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
fc7fe1d
fix: namespaces and package info
line-o cbeaa09
feat: backup and restore existing configuration
line-o c94469b
fix: expath package dependencies, bump version
line-o 86d0301
fix(api): error constructing status xml
line-o 1229819
refactor: rename blacklist to ignore
line-o 96287f9
refactor: optmise api handlers
line-o 9d439dc
fix(api): check collection parameter value
line-o e1d2713
fix(api): several issues with deployment
line-o 262567e
chore: remove unused files
line-o c10fbcd
style: min-height for main page
line-o 84d8926
fix(controller): tighten security, remove cruft
line-o 4d85d75
chore(app): rename one function
line-o 8acbc8a
chore: fix xqdoc
line-o 39a97ff
doc(api): clarify function purpose
line-o e4c209e
doc(api): clarify code checking for errors
line-o 8ca00a7
fix(controller): tighten security for api.json
line-o 4cd2919
fix(controller): cache-control for static files
line-o 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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
xquery version "3.1"; | ||
|
||
declare namespace sm="http://exist-db.org/xquery/securitymanager"; | ||
|
||
(: TODO: $target is not set in cleanup phase :) | ||
declare variable $configuration-collection := "/db/apps/tuttle/data/"; | ||
declare variable $backup-collection := "/db/tuttle-backup/"; | ||
declare variable $configuration-filename := "tuttle.xml"; | ||
|
||
(: backup tuttle configuration :) | ||
if (not(xmldb:collection-available($backup-collection))) | ||
then ((: move/copy to collection :) | ||
util:log("info", "Creating configuration backup collection"), | ||
xmldb:create-collection("/db", "tuttle-backup"), | ||
sm:chmod(xs:anyURI($backup-collection), "rwxr-x---") | ||
) | ||
else () | ||
, | ||
util:log("info", "Backing up configuration"), | ||
xmldb:move($configuration-collection, $backup-collection, $configuration-filename) |
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
xquery version "3.1"; | ||
|
||
declare namespace sm="http://exist-db.org/xquery/securitymanager"; | ||
|
||
(: the target collection into which the app is deployed :) | ||
declare variable $target external; | ||
|
||
declare variable $configuration-collection := $target || "/data/"; | ||
declare variable $backup-collection := "/db/tuttle-backup/"; | ||
declare variable $configuration-filename := "tuttle.xml"; | ||
|
||
(: look for backed up tuttle configuration :) | ||
if (doc-available($backup-collection || $configuration-filename)) | ||
then ((: move/copy to collection :) | ||
util:log("info", "Restoring tuttle configuration from backup."), | ||
xmldb:move($backup-collection, $configuration-collection, $configuration-filename), | ||
xmldb:remove($backup-collection) | ||
) | ||
else ((: copy example configuration when no backup was found :) | ||
util:log("info", "No previous tuttle configuration found."), | ||
xmldb:copy-resource( | ||
$configuration-collection, "tuttle-example-config.xml", | ||
$configuration-collection, $configuration-filename | ||
) | ||
) | ||
, | ||
(: tighten security for configuration file :) | ||
sm:chmod(xs:anyURI($configuration-collection || $configuration-filename), "rw-r-----") | ||
, | ||
(: set gid for API :) | ||
sm:chmod(xs:anyURI($target || "/modules/api.xql"), "rwxr-sr-x") | ||
|
This file was deleted.
Oops, something went wrong.
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
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.
see my comment on mattermost, I d really prefer a collection name that is more flexible for other apps as well, and won't lead to one collection per app with similar demands. so far we only have
system
andapp
following thedb
root collection. Lets create a third location for this kind of backup filesThere 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.
I do favour a broader solution as well. Please understand that this is not the right moment to set de-facto standards and the collection in this case is very short-lived. The entire
/db/tuttle-backup
is removed after installation.And I would also prefer to discuss a general solution within the community not just among us.
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.
happy to discuss a general solution with the community. I just don't see what we gain there, by adopting a single use solution now, instead of one that is open to extension
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.
If we choose a collection name that is
a) the one other apps will be using then it needs extra protection from removal and will have to stay there even if unused
b) not the one we are choosing here, the code has to be changed anyway