# SiteSetting file format update for locale override and hidden params based on Rails.env

**URL:** <https://meta.discourse.org/t/sitesetting-file-format-update-for-locale-override-and-hidden-params-based-on-rails-env/66254>\
**Category:** Development\
**Created:** [15 Julio, 2017 11:48 UTC](https://meta.discourse.org/t/sitesetting-file-format-update-for-locale-override-and-hidden-params-based-on-rails-env/66254 "2017-07-15T11:48:24Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![fantasticfears](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fantasticfears/32/119608_2.png) [@fantasticfears](https://meta.discourse.org/u/fantasticfears)\
**Post date:** [15 Julio, 2017 11:48 UTC](https://meta.discourse.org/t/sitesetting-file-format-update-for-locale-override-and-hidden-params-based-on-rails-env/66254/1 "2017-07-15T11:48:24Z")

</div>

I am working on the feature to allow overriding site setting based on the `default_locale`. @sam have talked with me that site setting based on environment is misleading. So I’d like to draw some proposals here to see which one is the best to go.

For the record, taking an example of the possible format:

```yml
min_search_term_length:
  client: true
  default:
    development: 2
    default: 3
  hidden:
    production: false
    development: true

```

As an aside, the overrides setting format will be:

```yml
min_search_term_length:
  client: true
  default: 3
  locale_default:
    zh_CN: 1
  hidden: false

```

## `hidden` property proposal

`hidden` only accepts a `true` value instead of dependending on env. I don’t think a good use to hide anything in the dev and test environment. There are only 4 cases under the `development` category.

## `Rails.env` params in the site setting

### Remove any `Rails.env` params in the site setting and put them in another yaml file.

Related site settings should be put on a file and loaded with site setting. Can be `config/site_settings_{dev,env}.yml`

- `+` The site setting file is clean.
- `+` The site settings are centralized in a place so that it’s easy to follow.
- `-` Another file

I’d prefer this for clarity.

### Put them into an initializer

Same pros as above. It’s not that obvious if they are put in `config/initializers/005-site_settings.rb`.

### Merge them with `locale_default`

Instead of sending them outside the site setting files, we can have a `override` params to put locale or env.

```yml
min_search_term_length:
  client: true
  default: 3
  default_overrides:
    development: 2
    zh_CN: 1

```

This style also looks good considering such overrides are not much.

---

_[View the full topic](https://meta.discourse.org/t/sitesetting-file-format-update-for-locale-override-and-hidden-params-based-on-rails-env/66254)._
