Integrated Haskell Platform

Learn how to configure IHP for use with Filebase.

What is Integrated Haskell Platform?

Integrated Haskell Platform, or IHP, is a full-stack framework developed to focus on rapid application deployment that utilizes robust code. IHP features a fully managed development environment, integrated development tooling, and quick response times within your production environment.

IHP has native integration for Filebase, making uploading to Filebase within your IHP code a single, seamless function. That means there’s no configuration of Filebase settings or endpoints needed, just your Filebase Access and Secret key pair.

Read below to learn how to use IHP with Filebase.

Prerequisites:

1. Open your IHP Config/Config.hs file.

Insert the following line to import the IHP.FileStorage.Config package:

import IHP.FileStorage.Config

2. Next, in the same file, add the following code snippet to call the function initFilebaseStorage:

module Config where

import IHP.Prelude
import IHP.Environment
import IHP.FrameworkConfig
import IHP.FileStorage.Config

config :: ConfigBuilder
config = do
    option Development
    option (AppHostname "localhost")

    initFilebaseStorage "FILEBASE_BUCKET_NAME"

Replace FILEBASE_BUCKET_NAME with your Filebase bucket name.

3. To connect to Filebase, you will need to set environment variables that contain your Filebase Access and Secret keys.

You can do so with the commands:

export FILEBASE_KEY="FILEBASE ACCESS KEY"

export FILEBASE_SECRET="FILEBASE SECRET KEY"

You can also set these as static variables in your IHP ./start script:

4. To upload your data from IHP to Filebase using this configuration, use the following syntax:

This assumes that data is in the following schema:

Last updated

Was this helpful?