<?xml version="1.0"?>
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
<!--
    SMF manifest for Barycenter OpenID Connect Identity Provider

    Install with:
      svccfg import barycenter.xml

    Enable with:
      svcadm enable barycenter
-->

<service_bundle type='manifest' name='barycenter'>

<service
    name='application/barycenter'
    type='service'
    version='1'>

    <create_default_instance enabled='false' />

    <single_instance />

    <!-- Dependencies -->
    <dependency
        name='network'
        grouping='require_all'
        restart_on='error'
        type='service'>
        <service_fmri value='svc:/milestone/network:default' />
    </dependency>

    <dependency
        name='filesystem'
        grouping='require_all'
        restart_on='error'
        type='service'>
        <service_fmri value='svc:/system/filesystem/local' />
    </dependency>

    <!-- Start/Stop Methods -->
    <exec_method
        type='method'
        name='start'
        exec='/opt/barycenter/bin/barycenter --config /etc/barycenter/config.toml &amp;'
        timeout_seconds='60'>
        <method_context>
            <method_credential user='barycenter' group='barycenter' />
            <method_environment>
                <envvar name='RUST_LOG' value='info' />
            </method_environment>
        </method_context>
    </exec_method>

    <exec_method
        type='method'
        name='stop'
        exec=':kill'
        timeout_seconds='60' />

    <!-- Properties -->
    <property_group name='startd' type='framework'>
        <propval name='duration' type='astring' value='contract' />
        <propval name='ignore_error' type='astring' value='core,signal' />
    </property_group>

    <property_group name='application' type='application'>
        <propval name='config_file' type='astring' value='/etc/barycenter/config.toml' />
        <propval name='data_dir' type='astring' value='/var/barycenter' />
    </property_group>

    <!-- Stability -->
    <stability value='Evolving' />

    <!-- Documentation -->
    <template>
        <common_name>
            <loctext xml:lang='C'>Barycenter OpenID Connect IdP</loctext>
        </common_name>
        <description>
            <loctext xml:lang='C'>
                Barycenter OpenID Connect Identity Provider with federation support
            </loctext>
        </description>
        <documentation>
            <manpage title='barycenter' section='1M' />
        </documentation>
    </template>

</service>

</service_bundle>
