-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tool for generating jwt tokens in cli
- Loading branch information
Showing
9 changed files
with
180 additions
and
6 deletions.
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,22 @@ | ||
ROD_TOKEN= | ||
ROD_INTENT_FEATURES_ENABLE= | ||
ROD_ADMIN_IDS= | ||
ROD_ADMIN_GUILD= | ||
ROD_DEV= | ||
ROD_DEV_GUILD_ID= | ||
ROD_PREFIX= | ||
|
||
ROD_ENABLE_API_SERVER= | ||
API_SERVER_HOST= | ||
API_SERVER_PORT= | ||
|
||
DB_HOST= | ||
DB_PORT= | ||
POSTGRES_PASSWORD= | ||
POSTGRES_USER= | ||
POSTGRES_DB= | ||
|
||
JWT_SECRET= | ||
DISCORD_CLIENT_ID= | ||
DISCORD_CLIENT_SECRET= | ||
DISCORD_REDIRECT_URI= |
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,80 @@ | ||
name: Test | ||
|
||
on: | ||
push: | ||
branches: | ||
- rewrite | ||
pull_request: | ||
|
||
jobs: | ||
analyze: | ||
name: dart analyze | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Setup Dart Action | ||
uses: dart-lang/setup-dart@v1 | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Cache | ||
uses: actions/cache@v4 | ||
with: | ||
path: ~/.pub-cache | ||
key: ${{ runner.os }}-pubspec-${{ hashFiles('**/pubspec.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-pubspec- | ||
- name: Install dependencies | ||
run: dart pub get | ||
|
||
- name: Analyze project source | ||
run: dart analyze | ||
|
||
fix: | ||
name: dart fix | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Setup Dart Action | ||
uses: dart-lang/setup-dart@v1 | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Cache | ||
uses: actions/cache@v4 | ||
with: | ||
path: ~/.pub-cache | ||
key: ${{ runner.os }}-pubspec-${{ hashFiles('**/pubspec.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-pubspec- | ||
- name: Install dependencies | ||
run: dart pub get | ||
|
||
- name: Analyze project source | ||
run: dart fix --dry-run | ||
|
||
format: | ||
name: dart format | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Setup Dart Action | ||
uses: dart-lang/setup-dart@v1 | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Cache | ||
uses: actions/cache@v4 | ||
with: | ||
path: ~/.pub-cache | ||
key: ${{ runner.os }}-pubspec-${{ hashFiles('**/pubspec.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-pubspec- | ||
- name: Install dependencies | ||
run: dart pub get | ||
|
||
- name: Format | ||
run: dart format --set-exit-if-changed -l120 . |
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 |
---|---|---|
|
@@ -11,6 +11,7 @@ doc/api/ | |
|
||
# dotenv environment variables file | ||
.env* | ||
!.env.dist | ||
|
||
# IDE configuration folders | ||
.vscode/ | ||
|
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 |
---|---|---|
|
@@ -2,3 +2,5 @@ include: package:lints/recommended.yaml | |
|
||
analyzer: | ||
exclude: [build/**] | ||
errors: | ||
implementation_imports: ignore |
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 @@ | ||
import 'package:running_on_dart/src/api/jwt_middleware.dart'; | ||
|
||
enum Commands { | ||
generateAdminJwt('generate-admin-jwt'); | ||
|
||
final String name; | ||
const Commands(this.name); | ||
|
||
static Commands byName(String name) { | ||
return values.firstWhere((e) => e.name == name); | ||
} | ||
} | ||
|
||
int main(List<String> args) { | ||
if (args.isEmpty) { | ||
print("Available commands: \n${Commands.values.map((e) => e.name).join(", ")}"); | ||
return -1; | ||
} | ||
|
||
final command = Commands.byName(args[0]); | ||
|
||
switch (command) { | ||
case Commands.generateAdminJwt: | ||
print(generateJwtKey("0", "test-user")); | ||
break; | ||
default: | ||
print("Command '$command' not recognized!"); | ||
return -1; | ||
} | ||
|
||
return 0; | ||
} |
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
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