get account id printing with leading zeros
This commit is contained in:
parent
4f0c608392
commit
ff81524caa
|
@ -215,7 +215,7 @@ fn generateCredentials(s: *std.build.Step, prog_node: *std.Progress.Node) error{
|
||||||
// },
|
// },
|
||||||
// ) catch return error.MakeFailed;
|
// ) catch return error.MakeFailed;
|
||||||
stdout.print(
|
stdout.print(
|
||||||
"# access_key: ELAK{s}, secret_key: {s}, account_number: {d}, db_encryption_key: {s}",
|
"# access_key: ELAK{s}, secret_key: {s}, account_number: {d:0>12}, db_encryption_key: {s}",
|
||||||
.{
|
.{
|
||||||
access_key_suffix_encoded,
|
access_key_suffix_encoded,
|
||||||
encoded_secret,
|
encoded_secret,
|
||||||
|
@ -224,7 +224,7 @@ fn generateCredentials(s: *std.build.Step, prog_node: *std.Progress.Node) error{
|
||||||
},
|
},
|
||||||
) catch return error.MakeFailed;
|
) catch return error.MakeFailed;
|
||||||
stdout.print(
|
stdout.print(
|
||||||
"\n#\n# You can copy/paste the following line into access_keys.csv:\nELAK{s},{s},{d},{s}\n",
|
"\n#\n# You can copy/paste the following line into access_keys.csv:\nELAK{s},{s},{d:0>12},{s}\n",
|
||||||
.{
|
.{
|
||||||
access_key_suffix_encoded,
|
access_key_suffix_encoded,
|
||||||
encoded_secret,
|
encoded_secret,
|
||||||
|
|
|
@ -38,7 +38,7 @@ pub fn accountForId(allocator: std.mem.Allocator, account_id: u40) !Self {
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Check STS
|
// TODO: Check STS
|
||||||
log.err("Got account id '{d}', but could not find this ('1234' is test account). STS GetAccessKeyInfo not implemented", .{account_id});
|
log.err("Got account id '{d:0>12}', but could not find this ('1234' is test account). STS GetAccessKeyInfo not implemented", .{account_id});
|
||||||
return error.NotImplemented;
|
return error.NotImplemented;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ pub fn dbForAccount(allocator: std.mem.Allocator, account_id: u40) !*sqlite.Db {
|
||||||
// TODO: Need to move this function somewhere central
|
// TODO: Need to move this function somewhere central
|
||||||
// TODO: Need configuration for what directory to use
|
// TODO: Need configuration for what directory to use
|
||||||
// TODO: Should this be a pool, and if so, how would we know when to close?
|
// TODO: Should this be a pool, and if so, how would we know when to close?
|
||||||
const file_without_path = try std.fmt.allocPrint(allocator, "ddb-{d}.sqlite3", .{account_id});
|
const file_without_path = try std.fmt.allocPrint(allocator, "ddb-{d:0>12}.sqlite3", .{account_id});
|
||||||
defer allocator.free(file_without_path);
|
defer allocator.free(file_without_path);
|
||||||
const db_file_name = try std.fs.path.joinZ(allocator, &[_][]const u8{ data_dir, file_without_path });
|
const db_file_name = try std.fs.path.joinZ(allocator, &[_][]const u8{ data_dir, file_without_path });
|
||||||
defer allocator.free(db_file_name);
|
defer allocator.free(db_file_name);
|
||||||
|
|
|
@ -144,7 +144,7 @@ pub fn handler(request: *AuthenticatedRequest, writer: anytype) ![]const u8 {
|
||||||
|
|
||||||
var al = std.ArrayList(u8).init(allocator);
|
var al = std.ArrayList(u8).init(allocator);
|
||||||
var response_writer = al.writer();
|
var response_writer = al.writer();
|
||||||
try response_writer.print("table created for account {d}\n", .{account_id});
|
try response_writer.print("table created for account {d:0>12}\n", .{account_id});
|
||||||
return al.toOwnedSlice();
|
return al.toOwnedSlice();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user