const proxy = require("http-proxy-middleware") var dotenv = require("dotenv") var dotenvExpand = require("dotenv-expand") var myEnv = dotenv.config() dotenvExpand.expand(myEnv) module.exports = { siteMetadata: { title: `Onegeo Portal`, subtitle: `Hub géospatial collaboratif`, description: `Solution Open Source sur-mesure pour communiquer et valoriser les données disponibles sur votre territoire ou vos infrastructures`, author: `GEOFIT`, icon: ``, theme: "light", }, plugins: [ `gatsby-plugin-react-helmet`, `gatsby-plugin-typescript`, `gatsby-plugin-image`, `gatsby-transformer-sharp`, `gatsby-plugin-sharp`, `gatsby-plugin-sitemap`, { resolve: `gatsby-plugin-env-variables`, options: { allowList: [ "PROJECT_INTERNAL_PROTOCOL", "PROJECT_INTERNAL_HOST", "PROJECT_INTERNAL_PORT", "PROJECT_PROTOCOL", "PROJECT_HOST", "PROJECT_PORT", "PROJECT_URL", "TYPESENSE_API_PATH", // TODO add API_TOKEN with Read Only privileges (client use) "TYPESENSE_API_TOKEN", "DIRECTUS_URL", "DIRECTUS_ASSETS_URL", "GRAPHQL_URL", ], }, }, { resolve: `gatsby-source-filesystem`, options: { name: `images`, path: `${__dirname}/src/images`, }, }, process.env.NODE_ENV === `development` ? { resolve: `gatsby-plugin-page-creator`, options: { path: `${__dirname}/src/pages-doc`, }, } : { resolve: `gatsby-plugin-page-creator`, options: { path: `${__dirname}/src/pages`, }, }, { resolve: "@onegeo/gatsby-source-directus", options: { url: process.env.DIRECTUS_URL, auth: { token: process.env.DIRECTUS_TOKEN, }, }, }, /* { resolve: `gatsby-plugin-typesense`, options: { publicDir: `./public`, // Required collectionSchema: { // Required name: "pages_v1", fields: [ { name: "title", type: "string", }, { name: "description", type: "string", }, { name: "typeData", type: "string", optional: true, facet: true, }, { name: "thumbnail", type: "string", optional: true, }, { name: "tags", type: "string[]", optional: true, facet: true, }, { name: "page_path", // Required type: "string", }, { name: "page_priority_score", // Required type: "int32", }, ], default_sorting_field: "page_priority_score", // Required }, server: { // Required apiKey: process.env.TYPESENSE_API_TOKEN, nodes: [ { protocol: process.env.PROJECT_INTERNAL_PROTOCOL || process.env.PROJECT_PROTOCOL, host: process.env.PROJECT_INTERNAL_HOST || process.env.PROJECT_HOST, port: process.env.PROJECT_INTERNAL_PORT || process.env.PROJECT_PORT, path: process.env.TYPESENSE_API_PATH || "/search/", }, ], }, }, }, */ // this (optional) plugin enables Progressive Web App + Offline functionality // To learn more, visit: https://gatsby.dev/offline // `gatsby-plugin-offline`, ], developMiddleware: (app) => { app.use( "/geoportal/", proxy.createProxyMiddleware("/geoportal/", { target: "https://rec.ww2.guyane-sig.fr", secure: false, }) ) }, }