Pre-launch — Gluecron is in final validation. Public signups and git hosting for non-owner users open after launch review.
CodeIssuesPull RequestsActionsSecurityInsightsSettings
✨ AI
More
Blame · Line-by-line history

GluecronPlugin.kt

Each line is annotated with the commit that last touched it. Click any SHA to jump to that commit and see the surrounding change.

GluecronPlugin.ktBlame48 lines · 1 contributor
0377886Claude1package com.gluecron
2
3import com.gluecron.settings.GluecronSettingsState
4import com.intellij.notification.NotificationGroupManager
5import com.intellij.notification.NotificationType
6import com.intellij.openapi.project.Project
7import com.intellij.openapi.startup.StartupActivity
8
9/**
10 * Post-startup activity for the Gluecron plugin.
11 *
12 * Runs once per project open, after the IDE has fully initialized.
13 * Responsibilities:
14 * 1. Seed settings from environment variables if not already configured
15 * (GLUECRON_HOST → host, GLUECRON_TOKEN → token).
16 * 2. Emit a notification if the host is still at the default localhost
17 * value so new users know to configure the plugin.
18 */
19class GluecronPlugin : StartupActivity {
20
21 override fun runActivity(project: Project) {
22 val settings = GluecronSettingsState.getInstance()
23
24 // Seed from environment variables on first run
25 val envHost = System.getenv("GLUECRON_HOST")
26 if (!envHost.isNullOrBlank() && settings.host == "http://localhost:3000") {
27 settings.host = envHost
28 }
29
30 val envToken = System.getenv("GLUECRON_TOKEN")
31 if (!envToken.isNullOrBlank() && settings.token.isBlank()) {
32 settings.token = envToken
33 }
34
35 // Warn if still using the default localhost address
36 if (settings.host == "http://localhost:3000" && settings.token.isBlank()) {
37 NotificationGroupManager.getInstance()
38 .getNotificationGroup("Gluecron Notifications")
39 .createNotification(
40 "Gluecron",
41 "Configure your Gluecron server URL and access token in " +
42 "<b>Settings → Tools → Gluecron</b>.",
43 NotificationType.INFORMATION
44 )
45 .notify(project)
46 }
47 }
48}