1818 */
1919public class N21AuthConfig
2020{
21+ public static final String COLOR_LIME_GREEN = "\u001B [92m" ;
22+ public static final String COLOR_YELLOW = "\u001B [93m" ;
23+ public static final String COLOR_STANDARD_RED = "\u001B [91m" ;
24+ public static final String COLOR_RESET = "\u001B [0m" ;
25+
2126 public final String host ;
2227 public final int port ;
2328 public final String username ;
@@ -95,21 +100,18 @@ public void ensureMysqlRunning()
95100 if (notInstalled )
96101 {
97102 CommonRails .printSystemComponent (this , this .hashCode (),
98- ". systemctl status mysql — MySQL NOT INSTALLED on this system ." ,
99- CommonRails .COLOR_STANDARD_RED );
103+ COLOR_STANDARD_RED + ". systemctl status mysql — MySQL NOT INSTALLED on this system ." + COLOR_RESET );
100104 return ;
101105 }
102106 else if (running )
103107 {
104108 CommonRails .printSystemComponent (this , this .hashCode (),
105- ". systemctl status mysql — active (running) ." ,
106- CommonRails .COLOR_LIME_GREEN );
109+ COLOR_LIME_GREEN + ". systemctl status mysql — active (running) ." + COLOR_RESET );
107110 }
108111 else
109112 {
110113 CommonRails .printSystemComponent (this , this .hashCode (),
111- ". systemctl status mysql — inactive / stopped ." ,
112- CommonRails .COLOR_YELLOW );
114+ COLOR_YELLOW + ". systemctl status mysql — inactive / stopped ." + COLOR_RESET );
113115
114116 if (useSudo )
115117 {
@@ -120,16 +122,15 @@ else if (running)
120122 boolean nowRunning = (recheck .exitValue () == 0 );
121123
122124 CommonRails .printSystemComponent (this , this .hashCode (),
123- ". systemctl start mysql — " + (nowRunning ? "now running ." : "FAILED to start ." ),
124- nowRunning ? CommonRails . COLOR_LIME_GREEN : CommonRails . COLOR_STANDARD_RED );
125+ (nowRunning ? COLOR_LIME_GREEN : COLOR_STANDARD_RED )
126+ + ". systemctl start mysql — " + ( nowRunning ? "now running ." : "FAILED to start ." ) + COLOR_RESET );
125127 }
126128 }
127129 }
128130 catch (Exception e )
129131 {
130132 CommonRails .printSystemComponent (this , this .hashCode (),
131- ". systemctl status mysql — check failed: " + e .getMessage () + " ." ,
132- CommonRails .COLOR_STANDARD_RED );
133+ COLOR_STANDARD_RED + ". systemctl status mysql — check failed: " + e .getMessage () + " ." + COLOR_RESET );
133134 }
134135
135136 // ── 2. JDBC login test using credentials from mysql.auth.xml ──────────
@@ -143,15 +144,13 @@ else if (running)
143144 try (Connection conn = DriverManager .getConnection (url , username , password ))
144145 {
145146 CommonRails .printSystemComponent (this , this .hashCode (),
146- ". MySQL JDBC login — user '" + username + "' authenticated successfully ." ,
147- CommonRails .COLOR_LIME_GREEN );
147+ COLOR_LIME_GREEN + ". MySQL JDBC login — user '" + username + "' authenticated successfully ." + COLOR_RESET );
148148 }
149149 }
150150 catch (Exception e )
151151 {
152152 CommonRails .printSystemComponent (this , this .hashCode (),
153- ". MySQL JDBC login — user '" + username + "' FAILED: " + e .getMessage () + " ." ,
154- CommonRails .COLOR_STANDARD_RED );
153+ COLOR_STANDARD_RED + ". MySQL JDBC login — user '" + username + "' FAILED: " + e .getMessage () + " ." + COLOR_RESET );
155154 }
156155 }
157156
0 commit comments