cancel
Showing results for 
Search instead for 
Did you mean: 
SOLVED

Access on configuration from custom snap

Access on configuration from custom snap

drschiffler
Established Member

Hi,

I will build a custom snap. It is the telegraf agent with an developed plugin for the datalayer SSE.

in the snapcraft.yml there will be something like this

grade: stable
confinement: strict

apps:
  ctrlx-telegraf:
    command: telegraf --config <PATH-TO-CONFIG>/config.conf
    daemon: simple
    restart-condition: always
    plugs: [network-bind]

The file config.conf is in toml syntax eg.:

[[outputs.influxdb_v2]]
  urls = ["https://ingest.example.de"]
  token = "xxxxx"
  organization = "ctrlx-vlab"
  bucket = "ctrlx"
  
[[inputs.ctrlxcore]]
  url = "https://192.168.1.1"
  username = "boschrexroth"
  password = "boschrexroth"
  node = "scheduler/tasks/ctrlXAutomation/info/counter"
  publishintervalms = "100"
  insecure_skip_verify = true

Questions:
1. Is it possible that this config file is part of the configuration which can be saved,downloaded, imported by the user via the webui?
2. Which path shall be specified in the snapcraft yaml?
3 REPLIES 3

CodeShepherd
Community Moderator
Community Moderator

Sorry for the delay.

To store data into the configurations manageable via the ctrlX CORE web interface you simple connect to the solution manager with a plug in your snapcraft.yaml:

plugs:
  active-solution:
    interface: content
    content: solutions
    target: $SNAP_COMMON/solutions

An them simply store your file in the active configuration:

/var/snap/rexroth-solutions/common/solutions/activeConfiguration/MyUserApp

 

Could you post a small code example how to store e.g. json file to this directory?

Or is there a more detailed documentation how to save and load custom snap data?

Thanks!

CodeShepherd
Community Moderator
Community Moderator
Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist