跳到主要内容

config/app.yaml

The configuration file is located at config/app.yaml. It is used to store the application settings.

General Configuration (Server)

# config/app.yaml
server:
mode: prod
address: 127.0.0.1
port: 8000 # No need to change if using docker compose
gracefulShutdownPeriod: 30
rateLimits:
- limitType: server
burst: 500
qps: 100
cacheSize: 1
- limitType: ip
burst: 50
qps: 10
cacheSize: 2048
# Frontend URL for sending email
baseUrl: https://localhost:5173

Mode

  • dev: Development mode, which is used for development.
  • prod: Production mode, which is used for production.
  • test: Test mode, which is used for testing.
  • debug: Debug mode, which is used for debugging.

JWT

The JWT secret and realm are used for JWT authentication.

# config/app.yaml
jwt:
secret: somesecret # Change this to a random string
realm: sccce
  • secret: The secret key for JWT.
  • realm: The realm for JWT.

Log Level

# config/app.yaml
log:
level: info

Sending Emails

Sending mails are required for the following purposes:

  1. User registration Verification Code
  2. User password reset Verification Code

There are two methods to send emails.

  1. SendGrid API (Default)
  2. SMTP through Gomail
  1. Create an account at SendGrid
  2. Create an API key
  3. Update the configuration File
# config/app.yaml

mail:
enable: true
sendgridAPIKey: your-api-key
account: sender-email

MongoDB Configuration

# config/app.yaml
db:
host: 127.0.0.1 # Change to `mongodb` if using docker compose
port: 27017
dbName: ${MONGO_DATABASE} # Takes from .env
username: ${MONGO_USERNAME} # Takes from .env
password: ${MONGO_PASSWORD} # Takes from .env
migrate: true # Not used currently

Redis Configuration

# config/app.yaml
redis:
enable: true # Currently does not have any use
port: 6379
host: localhost # or "redis" if using docker compose
password: ${REDIS_PASSWORD} # Takes from .env

GCE Configuration

# config/app.yaml
gce:
username: admin
password: admin
ssh:
host: gvmd
port: 22
username: devSSHuser
password: greenbone
gcePath: ./Greenbone/ # No need to change
scriptsDir: ./scripts/greenbone # No need to change
pyEnvPath: ./Greenbone/venv/ # No need to change

ELK

# config/app.yaml
elk:
enable: true
ip: 127.0.0.1
port: 9200
username: ${ELK_USERNAME} # Takes from .env
password: ${ELASTIC_PASSWORD} # Takes from .env

Example Configuration

# config/app.yaml
server:
mode: prod
address: 127.0.0.1
port: 8000
gracefulShutdownPeriod: 30
rateLimits:
- limitType: server
burst: 500
qps: 100
cacheSize: 1
- limitType: ip
burst: 50
qps: 10
cacheSize: 2048
# Frontend URL for sending email
baseUrl: https://localhost:5173

jwt:
secret: somesecret
realm: test

log:
level: info

db:
host: 127.0.0.1
port: 27017
dbName: sccce
username: fyp
password: somepassword
migrate: true

redis:
enable: true
port: 6379
host: localhost # host: "redis"
password: somepassword

mail:
enable: true # Set to true to enable mail service
# Required for all mail services
account: sender-email

# Uncomment Below to use SMTP
# # Use SMTP
# server: "smtp.office365.com"
# port: 587
# password: "your-password"

# Use SendGrid
sendgridAPIKey: your-api-key

gce:
username: admin
password: admin
ssh:
host: gvmd
port: 22
username: devSSHuser
password: greenbone
gcePath: ./Greenbone/
pyEnvPath: ./Greenbone/venv/