Creating setting(s) and client_setting(s) in plugin


(eriko) #1

So I am working on cas_sso and if I want to make it work with multi site I need to be able to add some site and client settings that are specific to the instance of the site. I have gotten dynamically creating omniauth.strategy working but unless I add the settings to the core site_settings.rb file I can not create/use them in the plugin.

Any thoughts on how to create settings outside of the core?


(eriko) #3

Just create a /plugins/plugin_name/config/settings.yml in the format of /config/settings.yml file.

 cas_sso:
  cas_sso_url:
    default: 'https://YOUR.CAS.SERVER/cas'

The first cas_sso: is the name that you will use later in client.*.yml to translate the name of plugin’s category.

For localization use
/plugins/plugin_name/config/locales/server.*.yml
to match any settings you make.

en:
  site_settings:
    cas_sso_url: 'If you ...hers.'

for example

/plugins/plugin_name/config/locales/client.*.yml
for the category name translation like

en:
  admin_js:
    admin:
      site_settings:
        categories:
          cas_sso: 'CAS SSO'

(Sam Saffron) #4

This is the polar opposite of what I intended with the plugin system, so cumbersome just to get 1 setting in… got to come up with a better way.