@@ -12,11 +12,13 @@ export function getSettings(explicitApiKey: string | undefined): CliSettings {
1212 const systemFile = _loadSystemFile ( ) ;
1313 const defaults = _loadDefaults ( ) ;
1414
15+ _legacyEnvVarWarning ( ) ;
16+
1517 return {
1618 auth : {
17- apiKey : explicitApiKey || env . REPLEXICA_API_KEY || systemFile . auth ?. apiKey || defaults . auth . apiKey ,
18- apiUrl : env . REPLEXICA_API_URL || systemFile . auth ?. apiUrl || defaults . auth . apiUrl ,
19- webUrl : env . REPLEXICA_WEB_URL || systemFile . auth ?. webUrl || defaults . auth . webUrl ,
19+ apiKey : explicitApiKey || env . LINGODOTDEV_API_KEY || systemFile . auth ?. apiKey || defaults . auth . apiKey ,
20+ apiUrl : env . LINGODOTDEV_API_URL || systemFile . auth ?. apiUrl || defaults . auth . apiUrl ,
21+ webUrl : env . LINGODOTDEV_WEB_URL || systemFile . auth ?. webUrl || defaults . auth . webUrl ,
2022 } ,
2123 } ;
2224}
@@ -47,9 +49,9 @@ function _loadDefaults(): CliSettings {
4749
4850function _loadEnv ( ) {
4951 return Z . object ( {
50- REPLEXICA_API_KEY : Z . string ( ) . optional ( ) ,
51- REPLEXICA_API_URL : Z . string ( ) . optional ( ) ,
52- REPLEXICA_WEB_URL : Z . string ( ) . optional ( ) ,
52+ LINGODOTDEV_API_KEY : Z . string ( ) . optional ( ) ,
53+ LINGODOTDEV_API_URL : Z . string ( ) . optional ( ) ,
54+ LINGODOTDEV_WEB_URL : Z . string ( ) . optional ( ) ,
5355 } )
5456 . passthrough ( )
5557 . parse ( process . env ) ;
@@ -83,3 +85,20 @@ function _getSettingsFilePath(): string {
8385 const settingsFilePath = path . join ( homedir , settingsFile ) ;
8486 return settingsFilePath ;
8587}
88+
89+ function _legacyEnvVarWarning ( ) {
90+ const env = _loadEnv ( ) ;
91+
92+ if ( env . REPLEXICA_API_KEY && ! env . LINGODOTDEV_API_KEY ) {
93+ console . warn (
94+ "\x1b[33m%s\x1b[0m" ,
95+ `
96+ ⚠️ WARNING: REPLEXICA_API_KEY env var is deprecated ⚠️
97+ ===========================================================
98+
99+ Please use LINGODOTDEV_API_KEY instead.
100+ ===========================================================
101+ ` ,
102+ ) ;
103+ }
104+ }
0 commit comments