This commit is contained in:
14
.env.example
Normal file
14
.env.example
Normal file
@@ -0,0 +1,14 @@
|
||||
JWT_SECRET=#jBhALXeYXC3$#e9
|
||||
RAPID_API_KEY=
|
||||
IRC_SERVER=irc.libera.chat
|
||||
IRC_CHANNEL="##usdev-dev"
|
||||
|
||||
REDIS_HOST=localhost
|
||||
REDIS_PASS=password
|
||||
|
||||
S3_ENDPOINT="localhost"
|
||||
S3_PORT=9000
|
||||
S3_USE_SSL=false
|
||||
S3_ACCESS_KEY="localminio"
|
||||
S3_SECRET_KEY="localminio"
|
||||
S3_BUCKET="devbucket"
|
3
.gitignore
vendored
3
.gitignore
vendored
@@ -33,4 +33,7 @@ lerna-debug.log*
|
||||
!.vscode/tasks.json
|
||||
!.vscode/launch.json
|
||||
.env
|
||||
.env.bak
|
||||
!.vscode/extensions.json
|
||||
|
||||
data/
|
||||
|
64
README.md
64
README.md
@@ -1,54 +1,28 @@
|
||||
# api.us.dev
|
||||
# us.dev Generalized API
|
||||
|
||||
## Description
|
||||
AKA _the monolith_
|
||||
|
||||
[Nest](https://github.com/nestjs/nest) framework TypeScript starter repository.
|
||||
## Quickstart
|
||||
|
||||
## Installation
|
||||
Dependencies:
|
||||
|
||||
```bash
|
||||
$ yarn install
|
||||
- Docker
|
||||
- Node 18
|
||||
|
||||
```sh
|
||||
# Copy example .env
|
||||
cp .env.example .env
|
||||
# Install Dependencies
|
||||
yarn
|
||||
# Start local services
|
||||
docker compose up -d
|
||||
# Copy default data into local minio
|
||||
cp -r default/* data/minio/devbucket
|
||||
# Start Application
|
||||
yarn start:dev
|
||||
```
|
||||
|
||||
## Running the app
|
||||
|
||||
```bash
|
||||
# development
|
||||
$ yarn run start
|
||||
|
||||
# watch mode
|
||||
$ yarn run start:dev
|
||||
|
||||
# production mode
|
||||
$ yarn run start:prod
|
||||
```
|
||||
|
||||
## Test
|
||||
|
||||
```bash
|
||||
# unit tests
|
||||
$ yarn run test
|
||||
|
||||
# e2e tests
|
||||
$ yarn run test:e2e
|
||||
|
||||
# test coverage
|
||||
$ yarn run test:cov
|
||||
```
|
||||
|
||||
## Support
|
||||
|
||||
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support).
|
||||
|
||||
## Stay in touch
|
||||
|
||||
- Author - [Kamil Myśliwiec](https://kamilmysliwiec.com)
|
||||
- Website - [https://nestjs.com](https://nestjs.com/)
|
||||
- Twitter - [@nestframework](https://twitter.com/nestframework)
|
||||
|
||||
## License
|
||||
|
||||
Nest is [MIT licensed](LICENSE).
|
||||
Visit http://localhost:3000/api
|
||||
|
||||
## Configuration
|
||||
|
||||
|
@@ -1,5 +1,20 @@
|
||||
version: '3'
|
||||
services:
|
||||
minio:
|
||||
image: bitnami/minio
|
||||
networks:
|
||||
- db_net
|
||||
ports:
|
||||
- 9000:9000
|
||||
- 9001:9001
|
||||
volumes:
|
||||
- ./data/minio:/bitnami/minio/data
|
||||
environment:
|
||||
- MINIO_ROOT_USER=localminio
|
||||
- MINIO_ROOT_PASSWORD=localminio
|
||||
- MINIO_DEFAULT_BUCKETS=devbucket
|
||||
env_file:
|
||||
- .env
|
||||
redis:
|
||||
image: redis
|
||||
networks:
|
||||
|
@@ -19,6 +19,7 @@ import { BullModule } from '@nestjs/bull';
|
||||
import { ScheduleModule } from '@nestjs/schedule';
|
||||
import { RedisClientOptions } from 'redis';
|
||||
import { redisStore } from 'cache-manager-redis-yet';
|
||||
import { RedirectsModule } from './redirects/redirects.module';
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
@@ -72,8 +73,9 @@ import { redisStore } from 'cache-manager-redis-yet';
|
||||
OgScraperModule,
|
||||
MinioModule,
|
||||
KvModule,
|
||||
RedirectsModule,
|
||||
],
|
||||
controllers: [AppController],
|
||||
providers: [AppService],
|
||||
})
|
||||
export class AppModule {}
|
||||
export class AppModule { }
|
||||
|
@@ -10,6 +10,10 @@ export default () => ({
|
||||
port: parseInt(process.env.IRC_PORT ?? '6697'),
|
||||
channel: process.env.IRC_CHANNEL ?? '#usdev',
|
||||
password: process.env.IRC_PASSWORD ?? '',
|
||||
nick:
|
||||
process.env.IRC_NICK ?? process.env.NODE_ENV === 'production'
|
||||
? 'us-bot'
|
||||
: 'us-dev',
|
||||
},
|
||||
redis: {
|
||||
host: process.env.REDIS_HOST ?? 'redis-master',
|
||||
|
@@ -18,7 +18,7 @@ export class IrcbotService {
|
||||
public readonly domainrProxy: DomainrproxyService,
|
||||
) {
|
||||
if (!this.configService.get<boolean>('irc.enabled')) return;
|
||||
const nick = process.env.NODE_ENV === 'production' ? 'us-bot' : 'us-dev';
|
||||
const nick = this.configService.get<string>('irc.nick') || 'us-dev';
|
||||
const ircPassword = this.configService.get<string>('irc.password');
|
||||
this.socket = connect({
|
||||
port: this.configService.get<number>('irc.port'),
|
||||
@@ -30,7 +30,7 @@ export class IrcbotService {
|
||||
if (ircPassword) this.client.pass(ircPassword);
|
||||
this.client.user(nick, `us.dev bot ${process.env.NODE_ENV}`);
|
||||
this.client.nick(nick);
|
||||
// this.client.send('nickserv', `identify ${nick} ${ircPassword}`);
|
||||
this.client.send('nickserv', `identify ${nick} ${ircPassword}`);
|
||||
console.log(nick);
|
||||
const channel: string = this.configService.get<string>(
|
||||
'irc.channel',
|
||||
|
@@ -15,8 +15,8 @@ export class MinioService {
|
||||
) {
|
||||
this.client = new Client({
|
||||
endPoint: this.configService.get<string>('S3_ENDPOINT', 's3.hooli.co'),
|
||||
port: this.configService.get<number>('S3_PORT', 443),
|
||||
useSSL: true,
|
||||
port: Number(this.configService.get<number>('S3_PORT', 443)),
|
||||
useSSL: this.configService.get<string>('S3_USE_SSL', 'true') === 'true',
|
||||
accessKey: this.configService.get<string>('S3_ACCESS_KEY', ''),
|
||||
secretKey: this.configService.get<string>('S3_SECRET_KEY', ''),
|
||||
});
|
||||
|
4
src/redirects/redirects.controller.ts
Normal file
4
src/redirects/redirects.controller.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
import { Controller } from '@nestjs/common';
|
||||
|
||||
@Controller('redirects')
|
||||
export class RedirectsController {}
|
7
src/redirects/redirects.module.ts
Normal file
7
src/redirects/redirects.module.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { RedirectsController } from './redirects.controller';
|
||||
|
||||
@Module({
|
||||
controllers: [RedirectsController]
|
||||
})
|
||||
export class RedirectsModule {}
|
9
src/redirects/required-reading.controller.ts
Normal file
9
src/redirects/required-reading.controller.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { Controller, Get } from '@nestjs/common';
|
||||
|
||||
@Controller({ host: "requiredreading.dev" })
|
||||
export class RequiredReadingController {
|
||||
@Get('')
|
||||
getRoot() {
|
||||
return "Hello required reading"
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user