Sha256: 7cc028c33a30fbb8b0f487a6a7b908807bf343bd655503cf0e8db6dac6e9ff8b

Contents?: true

Size: 1.75 KB

Versions: 3

Compression:

Stored size: 1.75 KB

Contents

class SystemSettings extends Lanes.Models.Base

    mixins: [ Lanes.Models.Mixins.FileSupport ]

    props:
        id:       {type:"integer"}
        settings: "object"

    associations:
        logo:  { model: "Lanes.Models.Asset" }

    modelTypeIdentifier: -> 'system-settings'
    url: -> Lanes.config.api_path + '/system-settings'
    initialize: ->
        @on('change:settings', @setDefaultSettings)
        @setDefaultSettings()

    setDefaultSettings: ->
        @settings ||= {}
        @settings.lanes || = {}

    forExtension: (ext) ->
        @settings[ext] ||= {}

    setValueForExtension: (ext, key, value) ->
        @forExtension(ext)[key] = value

class Config extends Lanes.Models.State

    session:
        csrf_token:  { type: 'string', setOnce: true }
        root_path:   { type: 'string', setOnce: true }
        api_path:    { type: 'string', setOnce: true }
        assets_path_prefix: { type: 'string', setOnce: true }
        environment: { type: 'string', setOnce: true }
        initial_workspace_screen_id: { type: 'string', setOnce: true }
        system_settings: { type: 'state', required: true }

    derived:
        env:
            deps: ['environment'], fn: ->
                {
                    test:        this.environment == 'test',
                    development: this.environment == 'development',
                    production:  this.environment == 'production'
                }

    initialize: ->
        @system_settings = new SystemSettings

    bootstrap: (options) ->
        if options.system_settings
            @system_settings.set(options.system_settings)
            delete options.system_settings
        @set(options)
        Lanes.Extensions.setBootstrapData(options) if _.isObject(options)

Lanes.config = new Config

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
lanes-0.5.6 client/lanes/Config.coffee
lanes-0.5.5 client/lanes/Config.coffee
lanes-0.5.0 client/lanes/Config.coffee