mirror of
				https://github.com/immich-app/immich.git
				synced 2025-11-03 19:17:11 -05:00 
			
		
		
		
	refactor(server): move host env to config repo (#13507)
* refactor(server): access host through repository * refactor(server): access host through repository
This commit is contained in:
		
							parent
							
								
									e8015dc7d7
								
							
						
					
					
						commit
						51d4899cd1
					
				@ -4,6 +4,7 @@ import { VectorExtension } from 'src/interfaces/database.interface';
 | 
			
		||||
export const IConfigRepository = 'IConfigRepository';
 | 
			
		||||
 | 
			
		||||
export interface EnvData {
 | 
			
		||||
  host?: string;
 | 
			
		||||
  port: number;
 | 
			
		||||
  environment: ImmichEnvironment;
 | 
			
		||||
  configFile?: string;
 | 
			
		||||
 | 
			
		||||
@ -50,6 +50,7 @@ export class ConfigRepository implements IConfigRepository {
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    return {
 | 
			
		||||
      host: process.env.IMMICH_HOST,
 | 
			
		||||
      port: Number(process.env.IMMICH_PORT) || 2283,
 | 
			
		||||
      environment,
 | 
			
		||||
      configFile: process.env.IMMICH_CONFIG_FILE,
 | 
			
		||||
 | 
			
		||||
@ -15,8 +15,6 @@ import { isStartUpError } from 'src/services/storage.service';
 | 
			
		||||
import { otelStart } from 'src/utils/instrumentation';
 | 
			
		||||
import { useSwagger } from 'src/utils/misc';
 | 
			
		||||
 | 
			
		||||
const host = process.env.HOST;
 | 
			
		||||
 | 
			
		||||
function parseTrustedProxy(input?: string) {
 | 
			
		||||
  if (!input) {
 | 
			
		||||
    return [];
 | 
			
		||||
@ -36,7 +34,7 @@ async function bootstrap() {
 | 
			
		||||
  const logger = await app.resolve<ILoggerRepository>(ILoggerRepository);
 | 
			
		||||
  const configRepository = app.get<IConfigRepository>(IConfigRepository);
 | 
			
		||||
 | 
			
		||||
  const { environment, port, resourcePaths } = configRepository.getEnv();
 | 
			
		||||
  const { environment, host, port, resourcePaths } = configRepository.getEnv();
 | 
			
		||||
  const isDev = environment === ImmichEnvironment.DEVELOPMENT;
 | 
			
		||||
 | 
			
		||||
  logger.setContext('Bootstrap');
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user