Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better server configuration #175

Merged
merged 1 commit into from
Jul 21, 2024
Merged

Better server configuration #175

merged 1 commit into from
Jul 21, 2024

Conversation

nt0xa
Copy link
Owner

@nt0xa nt0xa commented Jul 21, 2024

Switched to viper for configuration.
Now server can be configured with config file or environment variables.

Config file example:

ip = "127.0.0.1"
domain = "sonar.test"

[db]
dsn = "postgres://db:db@localhost:5432/db_test?sslmode=disable"

[tls]
type = "letsencrypt"

[tls.letsencrypt]
email = "admin@example.com"

[modules]
enabled = ["api", "telegram", "lark"]

[modules.api]
admin = "<TOKEN>"

[modules.telegram]
admin = 123456
token = "<BOT_TOKEN>"

[modules.lark]
admin = "<ADMIN_ID>"
app_id = "<APP_ID>"
app_secret = "<APP_SECRET>"
verification_token = "<VERIFICATION_TOKEN>"

Env example:

SONAR_IP=127.0.0.1
SONAR_DOMAIN=sonar.test
SONAR_DB_DSN='postgres://db:db@localhost:5432/db_test?sslmode=disable'
SONAR_TLS_TYPE=letsencrypt
SONAR_TLS_LETSENCRYPT_EMAIL=admin@example.com
SONAR_MODULES_ENABLED=api,telegram,lark
SONAR_MODULES_API_ADMIN=<TOKEN>
SONAR_MODULES_TELEGRAM_ADMIN=123456
SONAR_MODULES_TELEGRAM_TOKEN="<BOT_TOKEN>"
SONAR_MODULES_LARK_ADMIN="<USER_ID>"
SONAR_MODULES_LARK_APP_ID="<APP_ID>"
SONAR_MODULES_LARK_APP_SECRET="<APP_SECRET>"
SONAR_MODULES_LARK_VERIFICATION_TOKEN="<VERIFICATION_TOKEN>"

Switched to viper for configuration
@nt0xa nt0xa added feature New feature or request minor Minor changes labels Jul 21, 2024
Copy link

codecov bot commented Jul 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 72.95%. Comparing base (f94af79) to head (3e144a1).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #175      +/-   ##
==========================================
+ Coverage   72.88%   72.95%   +0.07%     
==========================================
  Files          64       63       -1     
  Lines        3857     3853       -4     
==========================================
  Hits         2811     2811              
+ Misses        803      799       -4     
  Partials      243      243              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@nt0xa nt0xa merged commit 4570a1c into master Jul 21, 2024
3 checks passed
@nt0xa nt0xa deleted the feat/server-config branch July 21, 2024 20:50
@nt0xa nt0xa mentioned this pull request Nov 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request minor Minor changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant