File tree 5 files changed +15
-0
lines changed
core/data-access/src/lib/config
5 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,8 @@ AUTH_SOLANA_ADMIN_IDS=
16
16
AUTH_SOLANA_ENABLED = true
17
17
# Enable Bull UI
18
18
BULL_ADMIN = admin:6c9107073a49d1e6129bfba07d494050c182d7630d3c86aca94ffa43cf1533f2
19
+ # Enable Bot auto-start
20
+ # BOT_AUTO_START=true
19
21
# Set Cloak keychain and master key (generate with `yarn cloak generate`)
20
22
CLOAK_MASTER_KEY =
21
23
CLOAK_KEYCHAIN =
Original file line number Diff line number Diff line change @@ -21,6 +21,10 @@ export class ApiBotManagerService implements OnModuleInit {
21
21
constructor ( private readonly core : ApiCoreService , private readonly botMember : ApiBotMemberService ) { }
22
22
23
23
async onModuleInit ( ) {
24
+ if ( ! this . core . config . botAutoStart ) {
25
+ this . logger . verbose ( `Bot auto start is disabled` )
26
+ return
27
+ }
24
28
const bots = await this . core . data . bot . findMany ( { where : { status : BotStatus . Active } } )
25
29
for ( const bot of bots ) {
26
30
this . logger . verbose ( `Starting bot ${ bot . name } ` )
Original file line number Diff line number Diff line change @@ -102,6 +102,10 @@ export class ApiCoreConfigService {
102
102
return this . service . get < string > ( 'apiUrl' ) as string
103
103
}
104
104
105
+ get botAutoStart ( ) : boolean {
106
+ return this . service . get < boolean > ( 'botAutoStart' ) ?? false
107
+ }
108
+
105
109
get cookieDomains ( ) : string [ ] {
106
110
return this . service . get < string [ ] > ( 'cookieDomains' ) ?? [ ]
107
111
}
Original file line number Diff line number Diff line change @@ -33,6 +33,8 @@ export interface ApiCoreConfig {
33
33
authSolanaAdminIds : string [ ]
34
34
authSolanaLinkEnabled : boolean
35
35
authSolanaLoginEnabled : boolean
36
+ // Bot
37
+ botAutoStart : boolean
36
38
// Cookies
37
39
cookieDomains : string [ ]
38
40
cookieName : string
@@ -69,6 +71,7 @@ export function configuration(): ApiCoreConfig {
69
71
authSolanaAdminIds : getFromEnvironment ( 'AUTH_SOLANA_ADMIN_IDS' ) ,
70
72
authSolanaLinkEnabled : process . env [ 'AUTH_SOLANA_LINK_ENABLED' ] === 'true' ,
71
73
authSolanaLoginEnabled : process . env [ 'AUTH_SOLANA_LOGIN_ENABLED' ] === 'true' ,
74
+ botAutoStart : process . env [ 'BOT_AUTO_START' ] === 'true' ,
72
75
cookieDomains,
73
76
cookieName : '__session' ,
74
77
cookieSecure : process . env [ 'COOKIE_SECURE' ] === 'true' ,
Original file line number Diff line number Diff line change @@ -15,6 +15,8 @@ export const validationSchema = Joi.object({
15
15
AUTH_SOLANA_ADMIN_IDS : Joi . string ( ) ,
16
16
AUTH_SOLANA_LINK_ENABLED : Joi . boolean ( ) . default ( true ) ,
17
17
AUTH_SOLANA_LOGIN_ENABLED : Joi . boolean ( ) . default ( false ) ,
18
+ // Bot
19
+ BOT_AUTO_START : Joi . boolean ( ) . default ( true ) ,
18
20
CLOAK_MASTER_KEY : Joi . string ( ) . required ( ) . error ( new Error ( `CLOAK_MASTER_KEY is required.` ) ) ,
19
21
CLOAK_KEYCHAIN : Joi . string ( ) . required ( ) . error ( new Error ( `CLOAK_KEYCHAIN is required.` ) ) ,
20
22
COOKIE_NAME : Joi . string ( ) . default ( '__session' ) ,
You can’t perform that action at this time.
0 commit comments