OxL Reference

method Flag.set

Replaces the rules of layer ("on", "off", "25%", "percent=25,by=tenant" or JSON).

Example:

oxl✓ checked in CI
dynamic Features {
  beta: Flag = Flag.off
}

fn main() io {
  let f = Features.get()
  let ann = Principal.User("ann", [], Map.new(), false, none)
  f.beta.set("on")!
  print("{f.beta.on(r#for: ann)}")
  match f.beta.set("sometimes") {
    DynError _ => print("rejected")
    _ => print("accepted")
  }
}
Output
true
rejected
pub(api) fn set(text: str, layer: DynScope = .Global) -> () | DynError

Since. 1.0.0-beta

Parameters

NameType
textstr
layerDynScope = .Global

Returns

()

Errors

  • DynError @error
  • `DynError` for rules that do not parse or when the policy refuses the caller.

Effects

none declared (pure unless the body says otherwise)

Defined in: std/core/dynconf.oxl:853

See also