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

[pirania] shared-state-priania - Fixes #507

Merged
merged 6 commits into from May 2, 2019
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

Next

Use md5 hash as shared-state key in pirania

  • Loading branch information...
gmarcos87 committed Apr 24, 2019
commit c8285cf41a23105bc99a5e1b3405119225a9db9d
@@ -30,8 +30,10 @@ end
local vouchers = JSON.parse(shell('voucher list_vouchers')) or {}
local result = {}

for _, voucher in pairs(vouchers) do
result[voucher.voucher] = voucher
for _,voucher in pairs(vouchers) do
local text = string.gsub(JSON.stringify(voucher), "\"", "")
local hash = shell('echo "'..text..'" | md5sum | cut -d " " -f 1'):gsub("\n","")
result[hash] = voucher
end

io.popen("shared-state insert pirania", "w"):write(JSON.stringify(result))
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.