@@ -68,4 +68,114 @@ export class AppConfigService {
6868 ( config . endpoint || config . accountId )
6969 ) ;
7070 }
71+
72+ /**
73+ * Check if production environment
74+ */
75+ get isProduction ( ) : boolean {
76+ return this . configService . get ( 'NODE_ENV' ) === 'production' ;
77+ }
78+
79+ /**
80+ * Check if development environment
81+ */
82+ get isDevEnv ( ) : boolean {
83+ const env = this . configService . get ( 'NODE_ENV' ) ;
84+ return env ?. toUpperCase ( ) === 'DEV' ;
85+ }
86+
87+ /**
88+ * Check if using remote database
89+ */
90+ get useRemoteDb ( ) : boolean {
91+ return this . configService . get ( 'USE_REMOTE_DB' ) === 'true' ;
92+ }
93+
94+ /**
95+ * Get database configuration
96+ */
97+ get dbConfig ( ) {
98+ return {
99+ host : this . configService . get ( 'DB_HOST' ) ,
100+ port : parseInt ( this . configService . get ( 'DB_PORT' ) , 10 ) ,
101+ username : this . configService . get ( 'DB_USERNAME' ) ,
102+ password : this . configService . get ( 'DB_PASSWORD' ) ,
103+ database : this . configService . get ( 'DB_DATABASE' ) || 'postgres' ,
104+ region : this . configService . get ( 'DB_REGION' ) ,
105+ } ;
106+ }
107+
108+ /**
109+ * Get GitHub configuration
110+ */
111+ get githubConfig ( ) {
112+ return {
113+ appId : this . configService . get ( 'GITHUB_APP_ID' ) ,
114+ privateKeyPath : this . configService . get ( 'GITHUB_PRIVATE_KEY_PATH' ) ,
115+ clientId : this . configService . get ( 'GITHUB_CLIENT_ID' ) ,
116+ clientSecret : this . configService . get ( 'GITHUB_CLIENT_SECRET' ) ,
117+ webhookSecret : this . configService . get ( 'GITHUB_WEBHOOK_SECRET' ) ,
118+ enabled : ! ! this . configService . get ( 'GITHUB_ENABLED' ) ,
119+ } ;
120+ }
121+
122+ get githubEnabled ( ) : boolean {
123+ return this . configService . get ( 'GITHUB_ENABLED' ) === 'true' ;
124+ }
125+
126+ get githubWebhookSecret ( ) : string {
127+ return this . configService . get ( 'GITHUB_WEBHOOK_SECRET' ) ;
128+ }
129+
130+ /**
131+ * Get mail domain for email links
132+ */
133+ get mailDomain ( ) : string {
134+ return this . configService . get ( 'MAIL_DOMAIN' ) ;
135+ }
136+
137+ /**
138+ * Get frontend URL for email links
139+ */
140+ get frontendUrl ( ) : string {
141+ return this . configService . get ( 'FRONTEND_URL' ) ;
142+ }
143+
144+ /**
145+ * Get mail configuration
146+ */
147+ get mailConfig ( ) {
148+ return {
149+ host : this . configService . get ( 'MAIL_HOST' ) ,
150+ port : parseInt ( this . configService . get ( 'MAIL_PORT' ) , 10 ) ,
151+ user : this . configService . get ( 'MAIL_USER' ) ,
152+ password : this . configService . get ( 'MAIL_PASSWORD' ) ,
153+ from : this . configService . get ( 'MAIL_FROM' ) ,
154+ } ;
155+ }
156+
157+ /**
158+ * Check if mail service is enabled
159+ */
160+ get isMailEnabled ( ) : boolean {
161+ return (
162+ this . configService . get ( 'MAIL_ENABLED' , 'false' ) . toLowerCase ( ) === 'true'
163+ ) ;
164+ }
165+
166+ get githubAppId ( ) : string {
167+ return this . configService . get ( 'GITHUB_APP_ID' ) ;
168+ }
169+
170+ get githubPrivateKeyPath ( ) : string {
171+ return this . configService . get ( 'GITHUB_PRIVATE_KEY_PATH' ) ;
172+ }
173+
174+ get githubClientId ( ) : string {
175+ return this . configService . get ( 'GITHUB_CLIENT_ID' ) ;
176+ }
177+
178+ get githubClientSecret ( ) : string {
179+ return this . configService . get ( 'GITHUB_CLIENT_SECRET' ) ;
180+ }
71181}
0 commit comments