Skip to content
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

[wip] Add a new endpoint /sqldump, exporting the data for the current modules #8

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions main.v
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
json
rand
time
os
)

const (
Expand Down Expand Up @@ -56,6 +57,11 @@ pub fn (app mut App) new() {
$vweb.html()
}

pub fn (app mut App) sqldump() {
thecodrr marked this conversation as resolved.
Show resolved Hide resolved
sql := os.exec('pg_dump vpm --table=modules --no-password --username=admin') or { return }
Copy link
Contributor

Choose a reason for hiding this comment

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

As useful as this is, what if the user's db is not named vpm?

Copy link
Member Author

Choose a reason for hiding this comment

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

It is already hardcoded in main.v . We can change it here and there to make it use env variables?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, that would be much better.

$vweb.html()
}

const (
max_name_len = 10
)
Expand Down
2 changes: 2 additions & 0 deletions sqldump.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
--- sql.exit_code: @sql.exit_code
@sql.output