Sitelet https://github.com/sourcejs/Source/issues/142
Skip to content

Define new options api interface and BE-FE options sharing strategy #142

Description

@robhrt7

Currently we break up all the settings for back-end modules and front-end modules, which makes configuration a bit more complex, especially with plugins. Proceeding with this structure, users always will need to think about where they should put config in.

I would like to merge BE and FE options, for easy sharing common parameters. If plugins uses both environments, it could have only one simple configuration:

{
plugins: {
  plugin: {
      commonOptions: true,
      feOption: false,
      beOptions: false
    }
  }
}

The problem: how to share all the setting with Front-end environment, without exposing private settings, that should not be available externally. Back-end part always have access to everything, for Front-end, only thing that stops us doing the same is privacy.

One of the solutions is to parse private storage, and strip it out on the way to Front-end:


{
plugins: {
  plugin: {
      commonOptions: true,
      feOption: false,
      private: {beOptions: false}
    }
  }
}

Where private: {beOptions: false} won't be exposed in /api/options call from the browser. But it might be not clear for plugin developers, and may cause potential leaks.

To discuss: should we expose everything by default, and hide private fields, or other way, hiding everything, and showing common fields?

After defining the solution, we will need to upgrade /api/options payload.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions