Skip to content
Snippets Groups Projects
gatsby-config.js 4.39 KiB
Newer Older
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",
        ],
      },
    },
    {
      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: "gatsby-source-graphql",
      options: {
        // Arbitrary name for the remote schema Query type
        typeName: "api",
        // Field under which the remote schema will be accessible. You'll use this in your Gatsby query
        fieldName: "api",
        // PROJECT_INTERNAL_* use docker hostname (whd build) and not public DNS (not always available from whd)
        url:
          (process.env.PROJECT_INTERNAL_PROTOCOL ||
            process.env.PROJECT_PROTOCOL ||
            "http") +
          "://" +
          (process.env.PROJECT_INTERNAL_HOST ||
            process.env.PROJECT_HOST ||
            "geokumo.apps.geofit.fr") +
          ":" +
          (process.env.PROJECT_INTERNAL_PORT ||
            process.env.PROJECT_PORT ||
            "80") +
          "/api/v1/graphql",
        headers: {
          // Learn about environment variables: https://gatsby.dev/env-vars
          "x-hasura-admin-secret": process.env.HASURA_API_TOKEN,
        },
      },
    },
Tojo's avatar
Tojo committed
    /*
    {
      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/",
            },
          ],
        },
      },
Tojo's avatar
Tojo committed
    },
    */
    // this (optional) plugin enables Progressive Web App + Offline functionality
    // To learn more, visit: https://gatsby.dev/offline
    // `gatsby-plugin-offline`,
  ],
};