Skip to content
Snippets Groups Projects
Select Git revision
  • master
  • 19-mettre-a-jour-la-df-pour-2025
  • debug-populations-initiales-garanties
  • 2-echec-du-deploiement-en-ci-au-tagging
  • Dorine-master-patch-01871
  • update-to-2023
  • plf-2023
  • loi-2022
  • 4.3.0
  • 4.2.0
  • 4.1.1
  • 4.1.0
  • 4.0.0
  • 3.0.2
  • 3.0.0
  • 2.0.2
  • 2.0.1
  • 2.0.0
  • 1.0.0
  • 0.9.0
  • 0.8.1
  • 0.8.0
  • 0.7.7
  • 0.7.4
  • 0.7.5
  • 0.7.3
  • 0.7.2
  • 0.7.1
28 results

setup.py

Blame
  • hooks.ts 1.37 KiB
    import type { GetSession } from "@sveltejs/kit"
    
    import config from "$lib/server/config"
    import { oauth2Authenticator } from "$lib/server/oauth2"
    
    const { githubPersonalAccessToken, openfiscaRepository } = config
    
    export const getSession: GetSession = async (event): Promise<App.Session> => {
      const oauth2Session = await oauth2Authenticator?.getSession(event)
      const user = oauth2Session?.user
      return {
        advanced: config.advanced,
        apiBaseUrls: config.apiBaseUrls,
        apiWebSocketBaseUrls: config.apiWebSocketBaseUrls,
        authenticationEnabled: oauth2Authenticator !== undefined,
        baseUrl: config.baseUrl,
        childrenKey: config.childrenKey,
        familyEntityKey: config.familyEntityKey,
        hasGithubPersonalAccessToken: githubPersonalAccessToken !== undefined,
        hiddenEntitiesKeyPlural: config.hiddenEntitiesKeyPlural,
        householdEntityKey: config.householdEntityKey,
        matomo: config.matomo,
        openfiscaRepository: {
          branch: openfiscaRepository.branch,
          group: openfiscaRepository.group,
          project: openfiscaRepository.project,
          rawUrlTemplate: openfiscaRepository.rawUrlTemplate,
          urlTemplate: openfiscaRepository.urlTemplate,
        },
        portalUrl: config.portalUrl,
        reformName: config.reformName,
        showTutorial: config.showTutorial,
        taxableHouseholdEntityKey: config.taxableHouseholdEntityKey,
        title: config.title,
        user,
      }
    }