• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

akutz / gofig
85%
master: 75%

Build:
Build:
LAST BUILD BRANCH: v0.1.9
DEFAULT BRANCH: master
Repo Added 09 Nov 2015 11:32PM UTC
Files 3
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

LAST BUILD ON BRANCH feature/scope-with-prefix
branch: feature/scope-with-prefix
CHANGE BRANCH
x
Reset
  • feature/scope-with-prefix
  • bugfix/copy-scope
  • bugfix/explicit-names
  • bugfix/pflag-compile
  • bugfix/scope-parent
  • bugfix/test-pflag-builds
  • feature/gotil
  • feature/interfaces-opt-pflag
  • feature/multi-regs
  • feature/override-registrations
  • feature/rm-pflag-tag
  • feature/scope
  • feature/scoped-prefixes
  • feature/secure-json
  • feature/viper-nofork-yaml
  • feature/yaml-validation
  • master
  • v0.1.0
  • v0.1.1
  • v0.1.2
  • v0.1.3
  • v0.1.4
  • v0.1.5
  • v0.1.6
  • v0.1.7
  • v0.1.8
  • v0.1.9

pending completion
41

push

travis-ci

akutz
Scope with Prefix

This patch introduces a new function, `ScopeWithPrefix`.

ScopeWithPrefix returns a scoped view of the configuration like the
Scope function, but this variant allows the specification of a prefix.
The prefix enables the creation of a scoped configuration that does
not have the fully-qualified paths to the desired configuration keys.
For example, imagine the following YAML:

    gofig:
      logging:
        enabled: true
      modules:
        admin:
          gofig:
            logging:
              enabled: true

To enable or disable logging the key is `gofig.logging.enabled`, but
the modules may require their own distinct values controlling logging
when using a scoped configuration via `Scope("gofig.modules.admin")`.
However, unless the complete key path of `gofig.logging.enabled` is
replicated under each named module, this isn't possible using the
standard key `gofig.logging.enabled`.

Using `ScopeWithPrefix("gofig.modules.admin", "gofig")` it is now
possible to enable the following YAML configuration so that the
scoped configuration can still use the `gofig.logging.enabled` key to
access the property value.

    gofig:
      logging:
        enabled: true
      modules:
        admin:
          logging:
            enabled: true

The prefix value is simply removed from key requests such that an
attempt to access the key `gofig.logging.enabled` actually results
in the access attempt using the key `logging.enabled`.

431 of 506 relevant lines covered (85.18%)

73.63 hits per line

Relevant lines Covered
Build:
Build:
506 RELEVANT LINES 431 COVERED LINES
73.63 HITS PER LINE
Source Files on feature/scope-with-prefix
  • List 0
  • Changed 1
  • Source Changed 0
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line

Recent builds

Builds Branch Commit Type Ran Committer Via Coverage
41 feature/scope-with-prefix Scope with Prefix This patch introduces a new function, `ScopeWithPrefix`. ScopeWithPrefix returns a scoped view of the configuration like the Scope function, but this variant allows the specification of a prefix. The prefix enables the creation... push 01 May 2016 01:35AM UTC akutz travis-ci pending completion  
39 feature/scope-with-prefix Scope with Prefix This patch introduces a new function, `ScopeWithPrefix`. ScopeWithPrefix returns a scoped view of the configuration like the Scope function, but this variant allows the specification of a prefix. The prefix enables the creation... push 01 May 2016 01:34AM UTC akutz travis-ci pending completion  
See All Builds (95)
  • Repo on GitHub
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc