Skip to content

Commit 6e61c39

Browse files
committed
some more stuff
1 parent 3b8c27d commit 6e61c39

File tree

4 files changed

+17
-17
lines changed

4 files changed

+17
-17
lines changed

tooling/sparta/packages/discord/README.md

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,17 @@ This package provides Discord bot functionality for the Sparta project. It commu
1515

1616
The bot supports the following slash commands:
1717

18-
| Command | Subcommand | Description | Parameters |
19-
| ----------- | -------------- | ------------------------------------------------------------------------------------------------ | ---------------------------------------------------- |
20-
| `/human` | `verify` | Verify your identity with Human Passport | None |
21-
| `/human` | `status` | Check your Human Passport verification status | None |
22-
| `/operator` | `chain-info` | Get current chain information including pending/proven blocks, epoch, slot, and current proposer | None |
23-
| `/operator` | `my-stats` | Check validator statistics | `address` (required): The validator address to check |
18+
| Command | Subcommand | Description | Parameters |
19+
| ----------- | -------------- | ------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------- |
20+
| `/human` | `verify` | Verify your identity with Human Passport | None |
21+
| `/human` | `status` | Check your Human Passport verification status | None |
22+
| `/operator` | `chain-info` | Get current chain information including pending/proven blocks, epoch, slot, and current proposer | None |
23+
| `/operator` | `my-stats` | Check validator statistics | `address` (required): The validator address to check |
2424
| `/operator` | `register` | Register as a validator and get the Apprentice role | `address` (optional): Your validator address<br>`block-number` (optional): Block number for verification<br>`proof` (optional): Your sync proof |
25-
| `/operator` | `help` | Display operator commands and instructions | None |
26-
| `/mod` | `help` | Display all moderator commands and their descriptions in a table | None |
27-
| `/mod` | `is-in-set` | Check if an address is in the validator set | `address` (required): The validator address to check |
28-
| `/mod` | `is-attesting` | Check if an address is actively attesting | `address` (required): The validator address to check |
25+
| `/operator` | `help` | Display operator commands and instructions | None |
26+
| `/mod` | `help` | Display all moderator commands and their descriptions in a table | None |
27+
| `/mod` | `is-in-set` | Check if an address is in the validator set | `address` (required): The validator address to check |
28+
| `/mod` | `is-attesting` | Check if an address is actively attesting | `address` (required): The validator address to check |
2929

3030
## Command Restrictions
3131

@@ -66,9 +66,8 @@ The following environment variables are required:
6666
- `BOT_TOKEN`: Discord bot token
6767
- `BOT_CLIENT_ID`: Discord client ID
6868
- `GUILD_ID`: Discord guild (server) ID
69-
- `API_URL`: Backend API server URL
7069
- `MINIMUM_SCORE`: Minimum score required for verification
71-
- `VITE_APP_API_URL`: Frontend URL for verification links
70+
- `VITE_APP_API_URL`: API URL for verification links and API
7271
- `NODE_ENV`: Environment setting, affects command restrictions and behavior
7372

7473
## Development

tooling/sparta/packages/discord/src/api/axios.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const apiInstance = new OpenAPIClientAxios({
66
// @ts-ignore
77
definition: apiDocs,
88
axiosConfigDefaults: {
9-
baseURL: process.env.API_URL || "http://localhost:3000",
9+
baseURL: process.env.VITE_APP_API_URL || "http://localhost:3000",
1010
timeout: 10_000,
1111
headers: {
1212
"Content-Type": "application/json",

tooling/sparta/packages/express/src/db/userRepository.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ export function extendDynamoDBWithUserMethods(): void {
129129
extendedDynamoDB.getAllUsers = async (): Promise<User[]> => {
130130
try {
131131
const command = new ScanCommand({
132-
TableName: process.env.USERS_TABLE_NAME,
132+
TableName: process.env.USERS_TABLE_NAME || "users",
133133
});
134134

135135
const response = await dynamoDB.getClient().send(command);
@@ -184,7 +184,7 @@ export function extendDynamoDBWithUserMethods(): void {
184184
}
185185

186186
const command = new PutCommand({
187-
TableName: process.env.USERS_TABLE_NAME,
187+
TableName: process.env.USERS_TABLE_NAME || "users",
188188
Item: dynamoUser,
189189
ConditionExpression: "attribute_not_exists(discordUserId)",
190190
});
@@ -285,7 +285,7 @@ export function extendDynamoDBWithUserMethods(): void {
285285
}
286286

287287
const command = new UpdateCommand({
288-
TableName: process.env.USERS_TABLE_NAME,
288+
TableName: process.env.USERS_TABLE_NAME || "users",
289289
Key: { discordUserId },
290290
UpdateExpression: updateExpression,
291291
ExpressionAttributeNames: expressionAttributeNames,
@@ -310,7 +310,7 @@ export function extendDynamoDBWithUserMethods(): void {
310310
): Promise<boolean> => {
311311
try {
312312
const command = new DeleteCommand({
313-
TableName: process.env.USERS_TABLE_NAME,
313+
TableName: process.env.USERS_TABLE_NAME || "users",
314314
Key: { discordUserId },
315315
});
316316

tooling/sparta/terraform/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,7 @@ resource "aws_ecs_task_definition" "sparta_api" {
493493
{ name = "LOG_LEVEL", value = var.log_level },
494494
{ name = "LOG_PRETTY_PRINT", value = var.log_pretty_print ? "true" : "false" },
495495
{ name = "VITE_APP_API_URL", value = "http://${aws_lb.sparta_alb.dns_name}" },
496+
{ name = "API_URL", value = "http://${aws_lb.sparta_alb.dns_name}" }, # Add API_URL for Discord bot
496497
{ name = "CORS_ALLOWED_ORIGINS", value = "http://${aws_lb.sparta_alb.dns_name}" },
497498
{ name = "USERS_TABLE_NAME", value = aws_dynamodb_table.sparta_users.name },
498499
{ name = "NODE_OPERATORS_TABLE_NAME", value = aws_dynamodb_table.sparta_node_operators.name }

0 commit comments

Comments
 (0)