title: Use ConfigService within `main.js` of Nest.js application
body: <p>I am trying to figure out how I can us my ConfigService <a href="https://docs.nestjs.com/techniques/configuration" rel="nofollow noreferrer">created as described here</a>. Within the top-most level of my application.</p>
  
  <p>My <code>main.js</code> file looks like this:</p>
  
  <pre><code>import { NestFactory } from '@nestjs/core';
  import { TypeormStore } from 'connect-typeorm';
  import * as session from 'express-session';
  import { getRepository } from 'typeorm';
  import { Session } from '../../domains/session/Session';
  import { AppModule } from './AppModule';
  
  async function bootstrap() {
      const app = await NestFactory.create(AppModule);
  
      app.use(session({
          resave: false,
          saveUninitialized: false,
          store: new TypeormStore({
              cleanupLimit: 2,
              ttl: 86400
          }).connect(getRepository(Session)),
          secret: process.env.COOKIE_SECRET as string
      }))
  
      await app.listen(3000);
  }
  bootstrap();
  
  </code></pre>
  
  <p>What I'd like is to move <code>process.env.COOKIE_SECRET</code> to a getter inside <code>ConfigService</code>. Can I access services at this level?</p>