Skip to content

Commit

Permalink
add: host option to config file
Browse files Browse the repository at this point in the history
  • Loading branch information
RainyXeon committed Aug 2, 2024
1 parent 357faaf commit 7774a6e
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions example.full.app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ utilities:

# WS/REST server for using web player
WEB_SERVER:
host: "0.0.0.0"
enable: false
port: 3000
whitelist: [] # Example: ["lavalink.dev"]
Expand Down
1 change: 1 addition & 0 deletions src/@types/Config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export interface Commands {
}

export interface WebServer {
host: string,
enable: boolean;
port: number;
auth: string;
Expand Down
1 change: 1 addition & 0 deletions src/services/ConfigDataService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ export class ConfigDataService {
retryTimeout: 3000,
},
WEB_SERVER: {
host: "0.0.0.0",
enable: false,
port: 2880,
auth: "youshallnotpass",
Expand Down
5 changes: 2 additions & 3 deletions src/web/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ export class WebServer {
app: Fastify.FastifyInstance;
constructor(private client: Manager) {
this.app = Fastify({
logger: false,
host: "0.0.0.0"
logger: false
});

this.app.register(
Expand Down Expand Up @@ -75,7 +74,7 @@ export class WebServer {
const port = this.client.config.utilities.WEB_SERVER.port;

this.app
.listen(port, "0.0.0.0")
.listen({ port, host: this.client.config.utilities.WEB_SERVER.host })
.then(() => this.client.logger.info(WebServer.name, `Server running at port ${port}`))
.catch((err) => {
if (this.client.config.bot.TOKEN.length > 1) {
Expand Down

0 comments on commit 7774a6e

Please sign in to comment.